/** * Transforms an object (page) to a string (number). * * @param PageInterface $page * @return mixed|string */ public function transform($page) { if (null === $page) { return ""; } return $page->getId(); }
/** * @param PageInterface $page * @return mixed */ public function save(PageInterface $page) { if (!$page->getId()) { $page->setContentRoute(new ContentRoute()); } $this->_em->persist($page); }
/** * Return the json response for the ajax edit action * * @param Form $form * @param PageInterface $page * @return Response */ protected function getAjaxEditResponse(Form $form, PageInterface $page) { $view = $form->createView(); // set the theme for the current Admin Form $this->get('twig')->getExtension('form')->renderer->setTheme($view, $this->admin->getFormTheme()); $pageSettingsHtml = $this->renderView('NetworkingInitCmsBundle:PageAdmin:ajax_page_settings.html.twig', array('action' => 'edit', 'form' => $view, 'object' => $page, 'admin' => $this->admin, 'admin_pool' => $this->get('sonata.admin.pool'))); return $this->renderJson(array('result' => 'ok', 'objectId' => $page->getId(), 'title' => $page->__toString(), 'messageStatus' => 'success', 'message' => $this->admin->trans('info.page_settings_updated'), 'pageStatus' => $this->admin->trans($page->getStatus()), 'pageSettings' => $pageSettingsHtml)); }
/** * @return int */ public function convertAliasToInteger() { if ($this->alias) { return $this->alias->getId(); } return null; }
/** * Get conversation * * @return int */ public function getPageId() { return $this->page->getId(); }