public function editPageNgAction($page_id)
 {
     $em = $this->getDoctrine()->getManager();
     $data = json_decode(file_get_contents("php://input"));
     $parameters = (object) $data;
     $page = Page::editPageById($em, $page_id, $parameters);
     $response = new Response(json_encode(array("result" => $page->getInArray())));
     $response->headers->set('Content-Type', 'application/json');
     return $response;
 }
Esempio n. 2
0
 public static function addPage($em, $parameters)
 {
     $page = new Page();
     $page->setUrl($parameters->url);
     if (isset($parameters->title)) {
         $page->setTitle($parameters->title);
     }
     if (isset($parameters->keywords)) {
         $page->setKeywords($parameters->keywords);
     }
     if (isset($parameters->description)) {
         $page->setDescription($parameters->description);
     }
     if (isset($parameters->content)) {
         $page->setContent($parameters->content);
     }
     $em->persist($page);
     $em->flush();
     return $page;
 }
Esempio n. 3
0
 public function getPageForUrl($url)
 {
     return Page::findPageByUrl($this->em, $url);
 }