コード例 #1
0
ファイル: ServiceGroup.php プロジェクト: Tom-Byrne/gocdb
 /**
  * Deletes a service group property
  *
  * @param \ServiceGroup $serviceGroup
  * @param \User $user
  * @param \SiteProperty $prop
  */
 public function deleteServiceGroupProperty(\ServiceGroup $serviceGroup, \User $user = null, \ServiceGroupProperty $prop)
 {
     // Check the portal is not in read only mode, throws exception if it is
     $this->checkPortalIsNotReadOnlyOrUserIsAdmin($user);
     $this->em->getConnection()->beginTransaction();
     try {
         // Site is the owning side so remove elements from site.
         $serviceGroup->getServiceGroupProperties()->removeElement($prop);
         $this->em->remove($prop);
         $this->em->flush();
         $this->em->getConnection()->commit();
     } catch (\Exception $e) {
         $this->em->getConnection()->rollback();
         $this->em->close();
         throw $e;
     }
 }