public function updateRule(AclRule $arule) { if ($arule === null) { throw new Exceptions\NullPointerException("Argument AclRule cannot be null"); } try { $this->entityManager->beginTransaction(); $dbRule = $this->aclRuleDao->find($arule->getId()); if ($dbRule !== null) { $dbRule->fromArray($arule->toArray()); $this->roleTypeHandle($dbRule); $this->entityManager->merge($dbRule); $this->entityManager->flush(); } $this->entityManager->commit(); $this->invalidateEntityCache($dbRule); $this->onUpdate($dbRule); } catch (DuplicateEntryException $e) { $this->entityManager->rollback(); $this->logWarning($e); throw new Exceptions\DuplicateEntryException($e->getMessage(), $e->getCode(), $e->getPrevious()); } catch (\Exception $e) { $this->entityManager->rollback(); $this->logError($e); throw new Exceptions\DataErrorException($e->getMessage(), $e->getCode(), $e->getPrevious()); } }