コード例 #1
0
ファイル: TestUtil.php プロジェクト: Tom-Byrne/gocdb
 public static function createSampleServiceProperty($name, $key)
 {
     $prop = new ServiceProperty();
     $prop->setKeyName($name);
     $prop->setKeyValue($key);
     return $prop;
 }
コード例 #2
0
ファイル: ServiceService.php プロジェクト: Tom-Byrne/gocdb
 /**
  * Edits a service property
  * @param \Service $service
  * @param \User $user
  * @param \ServiceProperty $prop
  * @param $newValues
  */
 public function editServiceProperty(\Service $service, \User $user, \ServiceProperty $prop, $newValues)
 {
     //Check the portal is not in read only mode, throws exception if it is
     $this->checkPortalIsNotReadOnlyOrUserIsAdmin($user);
     $this->validate($newValues['SERVICEPROPERTIES'], 'serviceproperty');
     $this->validateAddEditDeleteActions($user, $service);
     $keyname = $newValues['SERVICEPROPERTIES']['NAME'];
     $keyvalue = $newValues['SERVICEPROPERTIES']['VALUE'];
     $this->checkNotReserved($user, $service, $keyname);
     $this->em->getConnection()->beginTransaction();
     try {
         // Set the service 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;
     }
 }
コード例 #3
0
ファイル: Service.php プロジェクト: Tom-Byrne/gocdb
 /**
  * Add a ServiceProperty entity to this Service's collection of properties. 
  * This method also sets the ServiceProperty's parentService.  
  * @param \ServiceProperty $serviceProperty
  */
 public function addServicePropertyDoJoin($serviceProperty)
 {
     $this->serviceProperties[] = $serviceProperty;
     $serviceProperty->_setParentService($this);
 }