| @@ 17-39 (lines=23) @@ | ||
| 14 | * @param array $conditions |
|
| 15 | * @return ContentCollection |
|
| 16 | */ |
|
| 17 | public function matchContent(array $conditions) |
|
| 18 | { |
|
| 19 | $match = reset($conditions); |
|
| 20 | if (count($conditions) === 1 && in_array(($key = key($conditions)), array(self::MATCH_CONTENT_ID, self::MATCH_CONTENT_REMOTE_ID))) { |
|
| 21 | $match = (array)$match; |
|
| 22 | $contents = array(); |
|
| 23 | switch ($key) { |
|
| 24 | case self::MATCH_LOCATION_ID: |
|
| 25 | foreach($match as $contentId) { |
|
| 26 | $contents[] = $this->repository->getContentService()->loadContent($contentId); |
|
| 27 | } |
|
| 28 | break; |
|
| 29 | case self::MATCH_LOCATION_REMOTE_ID: |
|
| 30 | foreach($match as $contentRemoteId) { |
|
| 31 | $contents[] = $this->repository->getContentService()->loadContentByRemoteId($contentRemoteId); |
|
| 32 | } |
|
| 33 | break; |
|
| 34 | } |
|
| 35 | return new ContentCollection($contents); |
|
| 36 | } |
|
| 37 | ||
| 38 | return parent::matchContent($conditions); |
|
| 39 | } |
|
| 40 | } |
|
| @@ 17-39 (lines=23) @@ | ||
| 14 | * @param array $conditions |
|
| 15 | * @return LocationCollection |
|
| 16 | */ |
|
| 17 | public function matchLocation(array $conditions) |
|
| 18 | { |
|
| 19 | $match = reset($conditions); |
|
| 20 | if (count($conditions) === 1 && in_array(($key = key($conditions)), array(self::MATCH_LOCATION_ID, self::MATCH_LOCATION_REMOTE_ID))) { |
|
| 21 | $match = (array)$match; |
|
| 22 | $locations = array(); |
|
| 23 | switch ($key) { |
|
| 24 | case self::MATCH_LOCATION_ID: |
|
| 25 | foreach($match as $locationId) { |
|
| 26 | $locations[] = $this->repository->getLocationService()->loadLocation($locationId); |
|
| 27 | } |
|
| 28 | break; |
|
| 29 | case self::MATCH_LOCATION_REMOTE_ID: |
|
| 30 | foreach($match as $locationRemoteId) { |
|
| 31 | $locations[] = $this->repository->getLocationService()->loadLocationByRemoteId($locationRemoteId); |
|
| 32 | } |
|
| 33 | break; |
|
| 34 | } |
|
| 35 | return new LocationCollection($locations); |
|
| 36 | } |
|
| 37 | ||
| 38 | return parent::matchLocation($conditions); |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||