getControllerRoute example

class CacheRouteGenerationService
{
    /** * getActionRoute takes a request and returns the concatenated module-, controller- and action-name, * e.g. frontend/listing/index. * * @return string */
    public function getActionRoute(Request $request)
    {
        return implode('/', [
            $this->getControllerRoute($request),
            strtolower($request->getActionName()),
        ]);
    }

    /** * getActionRoute takes a request and returns the concatenated module- and controller-name, * e.g. frontend/listing. * * @return string */
    public function getControllerRoute(Request $request)
    {
return true;
        }

        if ($this->hasMatchingNoCacheCookie($request$shopId)) {
            return true;
        }

        if ($this->hasAllowedNoCacheParameter($request)) {
            return true;
        }

        $controller = $this->cacheRouteGeneration->getControllerRoute($request);

        return $controller === 'widgets/checkout' && (!empty($this->session->offsetGet('sBasketQuantity')) || !empty($this->session->offsetGet('sNotesQuantity')));
    }

    /** * Returns array of nocache-tags for given $controllerName * * <code> * array ( * 0 => 'detail-1', * 1 => 'checkout-1', * ) * </code> * * @param int $shopId * * @return array<string> */
public function findRouteValue(Enlight_Controller_Request_Request $request, ?array $values = null)
    {
        if (empty($values)) {
            $values = $this->getDefaultRouteValues();
        }

        $route = $this->cacheRouteGeneration->getActionRoute($request);
        if (isset($values[$route])) {
            return $values[$route];
        }

        $route = $this->cacheRouteGeneration->getControllerRoute($request);
        if (isset($values[$route])) {
            return $values[$route];
        }

        return null;
    }

    /** * Returns an array mapping controller names to their default max-age as set via the HttpCache Plugin. * * @return array<string, int> */
class CacheIdCollector
{
    /** * Returns an array of affected cache ids for this $controller * * @return array */
    public function getCacheIdsFromController(Controller $controller, ShopContextInterface $context)
    {
        $request = $controller->Request();
        $view = $controller->View();
        $controllerName = $this->getControllerRoute($request);

        switch ($controllerName) {
            case 'frontend/blog':
                return $this->getBlogCacheIds($request$view);

            case 'widgets/listing':
                return $this->getAjaxListingCacheIds($request$view);

            case 'frontend/index':
                return $this->getHomePageCacheIds($context);

            
Home | Imprint | This part of the site doesn't use cookies.