public function pagesListAction(Request $request)
    {
        $repository = $this->get('ekyna_cms.page.repository');

        $lastModifiedAt = $repository->getLastUpdatedAt();

        $response = new Response();
        $response->headers->set('Content-Type', 'application/json');
        $response->setLastModified($lastModifiedAt);

        if ($response->isNotModified($request)) {
            return $response;
        }

        $documentLocale = $request->query->get('document_locale', $request->getLocale());
        $list = [];

        /** @var \Ekyna\Bundle\CmsBundle\Model\PageInterface[] $pages */
        $pages = $this
            ->get('ekyna_cms.page.repository')
            ->findBy(['dynamicPath' => false], ['left' => 'ASC']);

        foreach ($pages as $page) {
            $list[] = $this->pageToArray($page, $documentLocale);
        }

        return $response->setContent(json_encode($list));
    }
public function pagesListAction(Request $request)
    {
        $repository = $this->get('ekyna_cms.page.repository');

        $lastModifiedAt = $repository->getLastUpdatedAt();

        $response = new Response();
        $response->headers->set('Content-Type', 'application/json');
        $response->setLastModified($lastModifiedAt);

        if ($response->isNotModified($request)) {
            return $response;
        }

        $documentLocale = $request->query->get('document_locale', $request->getLocale());
        $list = [];

        /** @var \Ekyna\Bundle\CmsBundle\Model\PageInterface[] $pages */
        $pages = $this
            ->get('ekyna_cms.page.repository')
            ->findBy(['dynamicPath' => false], ['left' => 'ASC']);

        foreach ($pages as $page) {
            $list[] = $this->pageToArray($page, $documentLocale);
        }

        return $response->setContent(json_encode($list));
    }
public function pagesListAction ( Request $ request ) { $ repository = $ this -> get ( 'ekyna_cms.page.repository' ) ; $ lastModifiedAt = $ repository -> getLastUpdatedAt ( ) ; $ response = new Response ( ) ; $ response -> headers -> set ( 'Content-Type' , 'application/json' ) ; $ response -> setLastModified ( $ lastModifiedAt ) ; if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } $ documentLocale = $ request -> query -> get ( 'document_locale' , $ request -> getLocale ( ) ) ; $ list = [ ] ; /** @var \Ekyna\Bundle\CmsBundle\Model\PageInterface[] $pages */ $ pages = $ this -> get ( 'ekyna_cms.page.repository' ) -> findBy ( [ 'dynamicPath' => false ] , [ 'left' => 'ASC' ] ) ; foreach ( $ pages as $ page ) { $ list [ ] = $ this -> pageToArray ( $ page , $ documentLocale ) ; } return $ response -> setContent ( json_encode ( $ list ) ) ; }
Pages list action.

@param Request $request

@return \Symfony\Component\HttpFoundation\Response
Pages list action .