Example #1
0
 public static function createSampleServiceProperty($name, $key)
 {
     $prop = new ServiceProperty();
     $prop->setKeyName($name);
     $prop->setKeyValue($key);
     return $prop;
 }
Example #2
0
 /**
  * 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;
     }
 }
Example #3
0
 /**
  * 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);
 }