Esempio n. 1
0
 public static function createSampleSiteProperty($key, $val)
 {
     $prop = new SiteProperty();
     $prop->setKeyName($key);
     $prop->setKeyValue($val);
     return $prop;
 }
Esempio n. 2
0
 /**
  * Add a SiteProperty entity to this Site's collection of properties. 
  * This method also sets the SiteProperty's parentSite. 
  * @param \SiteProperty $siteProperty
  */
 public function addSitePropertyDoJoin($siteProperty)
 {
     $this->siteProperties[] = $siteProperty;
     $siteProperty->_setParentSite($this);
 }
Esempio n. 3
0
 /**
  * Edits a site property
  *
  * @param \Site $site
  * @param \User $user
  * @param \SiteProperty $prop
  * @param
  *        	$newValues
  */
 public function editSiteProperty(\Site $site, \User $user = null, \SiteProperty $prop, $newValues)
 {
     // Check the portal is not in read only mode, throws exception if it is
     $this->checkPortalIsNotReadOnlyOrUserIsAdmin($user);
     //Validate User to perform this action
     $this->validatePropertyActions($user, $site);
     $this->validate($newValues['SITEPROPERTIES'], 'siteproperty');
     $keyname = $newValues['SITEPROPERTIES']['NAME'];
     $keyvalue = $newValues['SITEPROPERTIES']['VALUE'];
     $this->checkNotReserved($user, $site, $keyname);
     $this->em->getConnection()->beginTransaction();
     try {
         // Set the site propertys new member variables
         $prop->setKeyName($keyname);
         $prop->setKeyValue($keyvalue);
         $this->em->merge($prop);
         $this->em->flush();
         $this->em->getConnection()->commit();
     } catch (\Exception $ex) {
         $this->em->getConnection()->rollback();
         $this->em->close();
         throw $ex;
     }
 }