| @@ 59-85 (lines=27) @@ | ||
| 56 | /** |
|
| 57 | * @see \eZ\Publish\SPI\Persistence\Content\Location\Handler::loadLocationsByContent |
|
| 58 | */ |
|
| 59 | public function loadLocationsByContent($contentId, $rootLocationId = null) |
|
| 60 | { |
|
| 61 | if ($rootLocationId) { |
|
| 62 | $cache = $this->cache->getItem('content', 'locations', $contentId, 'root', $rootLocationId); |
|
| 63 | } else { |
|
| 64 | $cache = $this->cache->getItem('content', 'locations', $contentId); |
|
| 65 | } |
|
| 66 | $locationIds = $cache->get(); |
|
| 67 | if ($cache->isMiss()) { |
|
| 68 | $this->logger->logCall(__METHOD__, array('content' => $contentId, 'root' => $rootLocationId)); |
|
| 69 | $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($contentId, $rootLocationId); |
|
| 70 | ||
| 71 | $locationIds = array(); |
|
| 72 | foreach ($locations as $location) { |
|
| 73 | $locationIds[] = $location->id; |
|
| 74 | } |
|
| 75 | ||
| 76 | $cache->set($locationIds); |
|
| 77 | } else { |
|
| 78 | $locations = array(); |
|
| 79 | foreach ($locationIds as $locationId) { |
|
| 80 | $locations[] = $this->load($locationId); |
|
| 81 | } |
|
| 82 | } |
|
| 83 | ||
| 84 | return $locations; |
|
| 85 | } |
|
| 86 | ||
| 87 | /** |
|
| 88 | * @see \eZ\Publish\SPI\Persistence\Content\Location\Handler::loadParentLocationsForDraftContent |
|
| @@ 140-168 (lines=29) @@ | ||
| 137 | /** |
|
| 138 | * @see eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler::listURLAliasesForLocation |
|
| 139 | */ |
|
| 140 | public function listURLAliasesForLocation($locationId, $custom = false) |
|
| 141 | { |
|
| 142 | // Look for location to list of url alias id's cache |
|
| 143 | if ($custom) { |
|
| 144 | $cache = $this->cache->getItem('urlAlias', 'location', $locationId, 'custom'); |
|
| 145 | } else { |
|
| 146 | $cache = $this->cache->getItem('urlAlias', 'location', $locationId); |
|
| 147 | } |
|
| 148 | $urlAliasIds = $cache->get(); |
|
| 149 | if ($cache->isMiss()) { |
|
| 150 | $this->logger->logCall(__METHOD__, array('location' => $locationId, 'custom' => $custom)); |
|
| 151 | $urlAliases = $this->persistenceHandler->urlAliasHandler()->listURLAliasesForLocation($locationId, $custom); |
|
| 152 | ||
| 153 | $urlAliasIds = array(); |
|
| 154 | foreach ($urlAliases as $urlAlias) { |
|
| 155 | $urlAliasIds[] = $urlAlias->id; |
|
| 156 | } |
|
| 157 | ||
| 158 | $cache->set($urlAliasIds); |
|
| 159 | } else { |
|
| 160 | // Reuse loadUrlAlias for the url alias object cache |
|
| 161 | $urlAliases = array(); |
|
| 162 | foreach ($urlAliasIds as $urlAliasId) { |
|
| 163 | $urlAliases[] = $this->loadUrlAlias($urlAliasId); |
|
| 164 | } |
|
| 165 | } |
|
| 166 | ||
| 167 | return $urlAliases; |
|
| 168 | } |
|
| 169 | ||
| 170 | /** |
|
| 171 | * @see eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler::removeURLAliases |
|