src/Application/Controller/AbstractPageController.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Application\Controller;
  3. use App\Admin\Document\Article;
  4. use App\Admin\Document\Page;
  5. use App\Admin\Document\Tag;
  6. use App\Application\Cart\Cart;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use \Symfony\Component\Routing\Annotation\Route;
  9. abstract class AbstractPageController extends AbstractController
  10. {
  11.     protected abstract function getPageUrl();
  12.     protected function getIndexParams(Request $request) {
  13.         return [];
  14.     }
  15.     protected function getForSellerOnly() {
  16.         return false;
  17.     }
  18.     public function index(Request $request)
  19.     {
  20.         if ($this->getForSellerOnly() && !$this->getCart()->getCounterparty()) {
  21.             throw $this->createNotFoundException();
  22.         }
  23.         $page $this->setSeoByUrl($this->getPageUrl(), $request->getLocale());
  24.         return $this->render('application/' $this->getPageUrl() . '/index.html.twig'array_merge([
  25.             'page' => $page,
  26.         ], $this->getIndexParams($request)));
  27.     }
  28. }