Esempio n. 1
0
 public function createRole(Role $r)
 {
     if ($r === null) {
         throw new Exceptions\NullPointerException("Argument Role cannot be null");
     }
     try {
         $r->setParents($this->roleParentsCollSetup($r));
         $r->setAdded(new DateTime());
         $this->roleDao->save($r);
         $this->invalidateEntityCache();
         $this->onCreate($r);
     } catch (DuplicateEntryException $e) {
         $this->logWarning($e);
         throw new Exceptions\DuplicateEntryException($e->getMessage(), $e->getCode(), $e->getPrevious());
     } catch (\Exception $e) {
         $this->logError($e);
         throw new Exceptions\DataErrorException($e->getMessage(), $e->getCode(), $e->getPrevious());
     }
 }