Ejemplo n.º 1
0
 /**
  * Create new page.
  *
  * @return mixed
  *
  * @Route("/create", methods={"GET", "POST"}, name="admin-pages-create")
  */
 public function createAction()
 {
     $form = new CreateForm();
     $this->view->form = $form;
     if (!$this->request->isPost() || !$form->isValid()) {
         return;
     }
     $page = $form->getEntity();
     if (!empty($page->url)) {
         $page->url = str_replace('/', '', str_replace('\\', '', $page->url));
     }
     $page->save();
     $this->flashSession->success('New object created successfully!');
     return $this->response->redirect(['for' => "admin-pages-manage", 'id' => $page->id]);
 }