Loading module/Lieu/src/Assertion/StructureAssertion.php +1 −1 Changes for module/Lieu/src/Assertion/StructureAssertion.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ class StructureAssertion extends AbstractAssertion { if (!$role->getStructure()) return true; return $role->getStructure() == $structure; return $structure->inStructure($role->getStructure()); } } No newline at end of file module/Lieu/src/Service/StructureService.php +12 Changes for module/Lieu/src/Service/StructureService.php: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -259,10 +259,22 @@ class StructureService extends AbstractEntityService /** * @param Structure $entity * @return mixed * @throws \Doctrine\DBAL\Exception */ public function save($entity) { parent::save($entity); // TODO: Change the autogenerated stub $cStructure = $this->getServiceContext()->getStructure(); if ($cStructure){ if (!$entity->getStructure() || !$entity->getStructure()->inStructure($cStructure)){ throw new \Exception('La nouvelle structure doit hériter de '.$cStructure); } } $this->getEntityManager()->getConnection()->executeStatement('BEGIN OSE_DIVERS.UPDATE_STRUCTURES(); END;'); return $entity; Loading Loading
module/Lieu/src/Assertion/StructureAssertion.php +1 −1 Changes for module/Lieu/src/Assertion/StructureAssertion.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ class StructureAssertion extends AbstractAssertion { if (!$role->getStructure()) return true; return $role->getStructure() == $structure; return $structure->inStructure($role->getStructure()); } } No newline at end of file
module/Lieu/src/Service/StructureService.php +12 Changes for module/Lieu/src/Service/StructureService.php: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -259,10 +259,22 @@ class StructureService extends AbstractEntityService /** * @param Structure $entity * @return mixed * @throws \Doctrine\DBAL\Exception */ public function save($entity) { parent::save($entity); // TODO: Change the autogenerated stub $cStructure = $this->getServiceContext()->getStructure(); if ($cStructure){ if (!$entity->getStructure() || !$entity->getStructure()->inStructure($cStructure)){ throw new \Exception('La nouvelle structure doit hériter de '.$cStructure); } } $this->getEntityManager()->getConnection()->executeStatement('BEGIN OSE_DIVERS.UPDATE_STRUCTURES(); END;'); return $entity; Loading