public function createNew($arguments = array()) { /** @var BaseFileEntity $entity */ $entity = parent::createNew($arguments); $entity->setUser($this->container->getByType('Nette\\Security\\User')); return $entity; }
public function createNew($arguments = array()) { if (!count($arguments)) { $userPage = $this->getEntityManager()->getRepository('CmsModule\\Content\\Entities\\PageEntity')->findOneBy(array('special' => 'users')); $arguments = array($this->getEntityManager()->getRepository($userPage->class)->findOneBy(array('page' => $userPage->id))); } return parent::createNew($arguments); }
protected function createComponentNavbarForm() { $_this = $this; $form = $this->navbarForms[$this->formName]; $entity = $form->getEntityFactory() ? Callback::create($form->getEntityFactory())->invoke() : $this->repository->createNew(); $form = $form->getFactory()->invoke($entity); $form->onSuccess[] = $this->navbarFormSuccess; $form->onError[] = $this->navbarFormError; if ($this->mode == self::MODE_PLACE) { $form->addSubmit('_cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = function () use($_this) { $_this->redirect('this', array('formName' => NULL, 'mode' => NULL)); }; } return $form; }
/** * @param array $arguments * @return TagEntity */ public function createNew($arguments = array()) { return parent::createNew(array($this->getRssPageEntity())); }