public static function createSampleServiceGroupProperty($name, $key) { $prop = new ServiceGroupProperty(); $prop->setKeyName($name); $prop->setKeyValue($key); return $prop; }
/** * Edits a service group property * * @param \ServiceGroup $serviceGroup * @param \User $user * @param \ServiceGroupProperty $prop * @param $newValues * */ public function editServiceGroupProperty(\ServiceGroup $serviceGroup, \User $user = null, \ServiceGroupProperty $prop, $newValues) { // Check the portal is not in read only mode, throws exception if it is $this->checkPortalIsNotReadOnlyOrUserIsAdmin($user); $this->validate($newValues['SERVICEGROUPPROPERTIES'], 'servicegroupproperty'); $keyname = $newValues['SERVICEGROUPPROPERTIES']['NAME']; $keyvalue = $newValues['SERVICEGROUPPROPERTIES']['VALUE']; $this->checkNotReserved($user, $serviceGroup, $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; } }