Пример #1
0
 public function handlePublish($id)
 {
     if (!($entity = $this->repository->find($id))) {
         throw new BadRequestException();
     }
     $entity->route->published = !$entity->route->published;
     $this->repository->save($entity);
     if (!$this->presenter->isAjax()) {
         $this->redirect('this');
     }
     $this['table']->invalidateControl('table');
     $this->presenter->payload->url = $this->link('this', array('id' => NULL));
 }
Пример #2
0
 public function save($entity, $withoutFlush = self::FLUSH)
 {
     $en = $entity;
     while ($en = $en->getParent()) {
         if ($en == $entity) {
             throw new \Nette\InvalidArgumentException('Cyclic recursion detected. Please set else parent.');
         }
     }
     return parent::save($entity, $withoutFlush);
 }
Пример #3
0
 public function save($entity, $withoutFlush = self::FLUSH)
 {
     $parent = $entity instanceof ExtendedPageEntity ? $entity->getPage() : $entity;
     $main = $parent;
     while (($parent = $parent->parent) !== NULL) {
         if ($main->id === $parent->id) {
             throw new \Nette\InvalidArgumentException('Cyclic association detected!');
         }
     }
     if (!$this->isUnique($entity)) {
         throw new \Nette\InvalidArgumentException('Entity is not unique!');
     }
     return parent::save($entity, $withoutFlush);
 }
Пример #4
0
 public function connectWithUser(UserEntity $userEntity)
 {
     $userEntity->addSocialLogin($this->getSocialLoginEntity());
     $this->userRepository->save($userEntity);
 }
Пример #5
0
 public function save($entity, $withoutFlush = self::FLUSH)
 {
     $ret = parent::save($entity, $withoutFlush);
     $this->generateConfig();
     return $ret;
 }