コード例 #1
0
ファイル: AddPageFormFactory.php プロジェクト: svatekr/rsrs
 /**
  * @param Form $form
  * @param $form->values
  */
 private function formSubmitted(Form $form)
 {
     /** @var PagesEntity $pageParent */
     $pageParent = $this->pagesRepository->get($form->values->parent);
     $this->pagesRepository->begin();
     $this->pagesRepository->prepareBeforeAdd($pageParent);
     $this->page = new PagesEntity();
     $this->page->level($pageParent->level() + 1);
     $this->page->lft($pageParent->rgt());
     $this->page->rgt($pageParent->rgt() + 1);
     $this->page->parent($pageParent->id());
     $this->page->date(new DateTime());
     $this->page->upDate(new DateTime());
     $this->page->name($form->values->name);
     $this->page->inMenu(json_encode($form->values->inMenu));
     $this->page->menuTitle($form->values->menuTitle);
     $this->page->perex($form->values->perex);
     $this->page->text($form->values->text);
     $this->page->pictureName($form->values->pictureName);
     $this->page->pictureDescription($form->values->pictureDescription);
     $this->page->active($form->values->active);
     $this->page->onHomepage($form->values->onHomepage);
     $this->page->secret($form->values->secret);
     $this->page->title($form->values->title);
     $this->page->description($form->values->description);
     $this->page->keywords($form->values->keywords);
     $this->page->secretText($form->values->secretText);
     $this->page->galleryIds(json_encode($form->values->galleryIds));
     $this->page->upDate(new DateTime());
     $this->getUrl($form->values);
     $this->pagesRepository->commit();
 }