eZ\Publish\Core\Persistence\Cache\LocationHandler::loadParentLocationsForDraftContent PHP Method

loadParentLocationsForDraftContent() public method

See also: eZ\Publish\SPI\Persistence\Content\Location\Handler::loadParentLocationsForDraftContent
public loadParentLocationsForDraftContent ( $contentId )
    public function loadParentLocationsForDraftContent($contentId)
    {
        $cache = $this->cache->getItem('content', 'locations', $contentId, 'parentLocationsForDraftContent');
        $locationIds = $cache->get();
        if ($cache->isMiss()) {
            $this->logger->logCall(__METHOD__, array('content' => $contentId));
            $locations = $this->persistenceHandler->locationHandler()->loadParentLocationsForDraftContent($contentId);
            $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;
    }