eZ\Publish\Core\Persistence\Cache\LocationHandler::loadLocationsByContent PHP Метод

loadLocationsByContent() публичный Метод

См. также: eZ\Publish\SPI\Persistence\Content\Location\Handler::loadLocationsByContent
public loadLocationsByContent ( $contentId, $rootLocationId = null )
    public function loadLocationsByContent($contentId, $rootLocationId = null)
    {
        if ($rootLocationId) {
            $cache = $this->cache->getItem('content', 'locations', $contentId, 'root', $rootLocationId);
        } else {
            $cache = $this->cache->getItem('content', 'locations', $contentId);
        }
        $locationIds = $cache->get();
        if ($cache->isMiss()) {
            $this->logger->logCall(__METHOD__, array('content' => $contentId, 'root' => $rootLocationId));
            $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($contentId, $rootLocationId);
            $locationIds = array();
            foreach ($locations as $location) {
                $locationIds[] = $location->id;
            }
            $cache->set($locationIds)->save();
        } else {
            $locations = array();
            foreach ($locationIds as $locationId) {
                $locations[] = $this->load($locationId);
            }
        }
        return $locations;
    }