DmitryDulepov\Realurl\Cache\DatabaseCache::getUrlFromCacheByOriginalUrl PHP Method

getUrlFromCacheByOriginalUrl() public method

Gets the entry from cache.
public getUrlFromCacheByOriginalUrl ( integer $rootPageId, string $originalUrl ) : DmitryDulepov\Realurl\Cache\UrlCacheEntry | null
$rootPageId integer
$originalUrl string
return DmitryDulepov\Realurl\Cache\UrlCacheEntry | null
    public function getUrlFromCacheByOriginalUrl($rootPageId, $originalUrl)
    {
        $cacheEntry = NULL;
        $row = $this->databaseConnection->exec_SELECTgetSingleRow('*', 'tx_realurl_urldata', 'rootpage_id=' . (int) $rootPageId . ' AND ' . 'original_url=' . $this->databaseConnection->fullQuoteStr($originalUrl, 'tx_realurl_urldata'), '', 'expire');
        if (is_array($row)) {
            $cacheEntry = GeneralUtility::makeInstance('DmitryDulepov\\Realurl\\Cache\\UrlCacheEntry');
            /** @var \DmitryDulepov\Realurl\Cache\UrlCacheEntry $cacheEntry */
            $cacheEntry->setCacheId($row['uid']);
            $cacheEntry->setExpiration($row['expire']);
            $cacheEntry->setPageId($row['page_id']);
            $cacheEntry->setRootPageId($row['rootpage_id']);
            $cacheEntry->setOriginalUrl($originalUrl);
            $cacheEntry->setSpeakingUrl($row['speaking_url']);
            $requestVariables = json_decode($row['request_variables'], TRUE);
            // TODO Log a problem here because it must be an array always
            $cacheEntry->setRequestVariables(is_array($requestVariables) ? $requestVariables : array());
        }
        return $cacheEntry;
    }