getActionRoute example



        if ($request->getCookie('slt')) {
            $tags[] = 'slt';
        }

        if (strtolower($request->getModuleName()) === 'frontend' && !empty($this->session->Admin)) {
            // Set admin-cookie if admin session is present             $tags[] = 'admin';
        }

        $action = $this->cacheRouteGeneration->getActionRoute($request);
        if ($action === 'frontend/account/logout') {
            $tags[] = '';
        }

        return $tags;
    }

    /** * Returns a list of tags which has to be deleted from the no cache cookie * * @return string[] */
 {
        $this->cacheTimeService = $cacheTimeService;
        $this->cacheRouteGeneration = $cacheRouteGeneration;
        $this->invalidationDateProvider = iterator_to_array($invalidationDateProvider, false);
    }

    /** * {@inheritdoc} */
    public function getCacheTime(Request $request)
    {
        $action = $this->cacheRouteGeneration->getActionRoute($request);
        $invalidationDate = null;
        $defaultInvalidationTime = $this->cacheTimeService->getCacheTime($request);

        /** @var InvalidationDateInterface $dateProvider */
        foreach ($this->invalidationDateProvider as $dateProvider) {
            if ($dateProvider->supportsRoute($action) && $invalidationDate = $dateProvider->getInvalidationDate($request)) {
                $difference = (int) $invalidationDate->format('U') - (int) (new DateTime())->format('U');

                return $difference > 0 && $difference < $defaultInvalidationTime ? $difference : $defaultInvalidationTime;
            }
        }

        

    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;
    }

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