<?php
namespace App\Application\Controller;
use App\Admin\Document\Article;
use App\Admin\Document\Page;
use App\Admin\Document\Tag;
use App\Application\Cart\Cart;
use Symfony\Component\HttpFoundation\Request;
use \Symfony\Component\Routing\Annotation\Route;
abstract class AbstractPageController extends AbstractController
{
protected abstract function getPageUrl();
protected function getIndexParams(Request $request) {
return [];
}
protected function getForSellerOnly() {
return false;
}
public function index(Request $request)
{
if ($this->getForSellerOnly() && !$this->getCart()->getCounterparty()) {
throw $this->createNotFoundException();
}
$page = $this->setSeoByUrl($this->getPageUrl(), $request->getLocale());
return $this->render('application/' . $this->getPageUrl() . '/index.html.twig', array_merge([
'page' => $page,
], $this->getIndexParams($request)));
}
}