@@ -308,6 +308,9 @@ |
||
| 308 | 308 | return $out; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | + /** |
|
| 312 | + * @return string |
|
| 313 | + */ |
|
| 311 | 314 | protected function hash2SortOrder($value) |
| 312 | 315 | { |
| 313 | 316 | $sortOrder = null; |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | return new Query\Criterion\DateMetadata(Query\Criterion\DateMetadata::CREATED, self::$operatorsMap[$operator], $match); |
| 147 | 147 | |
| 148 | 148 | case self::MATCH_GROUP: |
| 149 | - foreach($values as &$value) { |
|
| 149 | + foreach ($values as &$value) { |
|
| 150 | 150 | if (!ctype_digit($value)) { |
| 151 | 151 | $value = $this->groupMatcher->matchOneByKey($value)->id; |
| 152 | 152 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | return new Query\Criterion\DateMetadata(Query\Criterion\DateMetadata::MODIFIED, self::$operatorsMap[$operator], $match); |
| 166 | 166 | |
| 167 | 167 | case self::MATCH_OBJECT_STATE: |
| 168 | - foreach($values as &$value) { |
|
| 168 | + foreach ($values as &$value) { |
|
| 169 | 169 | if (!ctype_digit($value)) { |
| 170 | 170 | $value = $this->stateMatcher->matchOneByKey($value)->id; |
| 171 | 171 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | return new Query\Criterion\ObjectStateId($values); |
| 174 | 174 | |
| 175 | 175 | case self::MATCH_OWNER: |
| 176 | - foreach($values as &$value) { |
|
| 176 | + foreach ($values as &$value) { |
|
| 177 | 177 | if (!ctype_digit($value)) { |
| 178 | 178 | $value = $this->userMatcher->matchOneByKey($value)->id; |
| 179 | 179 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | return new Query\Criterion\ParentLocationId($locationIds); |
| 194 | 194 | |
| 195 | 195 | case self::MATCH_SECTION: |
| 196 | - foreach($values as &$value) { |
|
| 196 | + foreach ($values as &$value) { |
|
| 197 | 197 | if (!ctype_digit($value)) { |
| 198 | 198 | $value = $this->sectionMatcher->matchOneByKey($value)->id; |
| 199 | 199 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | case self::MATCH_AND: |
| 216 | 216 | $subCriteria = array(); |
| 217 | - foreach($values as $subCriterion) { |
|
| 217 | + foreach ($values as $subCriterion) { |
|
| 218 | 218 | $value = reset($subCriterion); |
| 219 | 219 | $subCriteria[] = $this->getQueryCriterion(key($subCriterion), $value); |
| 220 | 220 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | case self::MATCH_OR: |
| 224 | 224 | $subCriteria = array(); |
| 225 | - foreach($values as $subCriterion) { |
|
| 225 | + foreach ($values as $subCriterion) { |
|
| 226 | 226 | $value = reset($subCriterion); |
| 227 | 227 | $subCriteria[] = $this->getQueryCriterion(key($subCriterion), $value); |
| 228 | 228 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | $direction = $this->hash2SortOrder($sortItem['sort_order']); |
| 261 | 261 | |
| 262 | - switch($sortItem['sort_field']) { |
|
| 262 | + switch ($sortItem['sort_field']) { |
|
| 263 | 263 | case SELF::SORT_CONTENT_ID: |
| 264 | 264 | $out[] = new SortClause\ContentId($direction); |
| 265 | 265 | break; |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | public function sortField2Hash($value) |
| 41 | 41 | { |
| 42 | 42 | $ref = new \ReflectionClass('eZ\Publish\API\Repository\Values\Content\Location'); |
| 43 | - foreach($ref->getConstants() as $key => $val) { |
|
| 43 | + foreach ($ref->getConstants() as $key => $val) { |
|
| 44 | 44 | if (strpos($key, 'SORT_FIELD_') === 0 && $val == $value) { |
| 45 | 45 | $out = strtolower(substr($key, 11)); |
| 46 | 46 | if ($out == 'contentobject_id') { |
@@ -71,7 +71,9 @@ discard block |
||
| 71 | 71 | if (!empty($sort)) { |
| 72 | 72 | $query->sortClauses = $this->getSortClauses($sort); |
| 73 | 73 | } |
| 74 | - if (isset($query->performCount)) $query->performCount = false; |
|
| 74 | + if (isset($query->performCount)) { |
|
| 75 | + $query->performCount = false; |
|
| 76 | + } |
|
| 75 | 77 | $query->filter = $this->getQueryCriterion($key, $values); |
| 76 | 78 | $results = $this->repository->getSearchService()->findLocations($query); |
| 77 | 79 | |
@@ -218,7 +220,9 @@ discard block |
||
| 218 | 220 | { |
| 219 | 221 | $query = new LocationQuery(); |
| 220 | 222 | $query->limit = self::INT_MAX_16BIT; |
| 221 | - if (isset($query->performCount)) $query->performCount = false; |
|
| 223 | + if (isset($query->performCount)) { |
|
| 224 | + $query->performCount = false; |
|
| 225 | + } |
|
| 222 | 226 | $query->filter = new Query\Criterion\ParentLocationId($parentLocationIds); |
| 223 | 227 | |
| 224 | 228 | $results = $this->repository->getSearchService()->findLocations($query); |
@@ -15,7 +15,6 @@ |
||
| 15 | 15 | * @param array $sort |
| 16 | 16 | * @param int $offset |
| 17 | 17 | * @param int $limit |
| 18 | - |
|
| 19 | 18 | * @return LocationCollection |
| 20 | 19 | */ |
| 21 | 20 | public function matchLocation(array $conditions, array $sort = array(), $offset = 0, $limit = 0) |
@@ -103,7 +103,9 @@ discard block |
||
| 103 | 103 | $query = new Query(); |
| 104 | 104 | $query->limit = $limit != 0 ? $limit : self::INT_MAX_16BIT; |
| 105 | 105 | $query->offset = $offset; |
| 106 | - if (isset($query->performCount)) $query->performCount = false; |
|
| 106 | + if (isset($query->performCount)) { |
|
| 107 | + $query->performCount = false; |
|
| 108 | + } |
|
| 107 | 109 | $query->filter = $this->getQueryCriterion($key, $values); |
| 108 | 110 | if (!empty($sort)) { |
| 109 | 111 | $query->sortClauses = $this->getSortClauses($sort); |
@@ -229,7 +231,9 @@ discard block |
||
| 229 | 231 | { |
| 230 | 232 | $query = new Query(); |
| 231 | 233 | $query->limit = self::INT_MAX_16BIT; |
| 232 | - if (isset($query->performCount)) $query->performCount = false; |
|
| 234 | + if (isset($query->performCount)) { |
|
| 235 | + $query->performCount = false; |
|
| 236 | + } |
|
| 233 | 237 | $query->filter = new Query\Criterion\ParentLocationId($parentLocationIds); |
| 234 | 238 | $results = $this->repository->getSearchService()->findContent($query); |
| 235 | 239 | |
@@ -269,7 +273,9 @@ discard block |
||
| 269 | 273 | { |
| 270 | 274 | $query = new Query(); |
| 271 | 275 | $query->limit = self::INT_MAX_16BIT; |
| 272 | - if (isset($query->performCount)) $query->performCount = false; |
|
| 276 | + if (isset($query->performCount)) { |
|
| 277 | + $query->performCount = false; |
|
| 278 | + } |
|
| 273 | 279 | $query->filter = new Query\Criterion\ContentTypeIdentifier($contentTypeIdentifiers); |
| 274 | 280 | // sort objects by depth, lower to higher, so that deleting them has less chances of failure |
| 275 | 281 | // NB: we only do this in eZP versions that allow depth sorting on content queries |
@@ -297,7 +303,9 @@ discard block |
||
| 297 | 303 | { |
| 298 | 304 | $query = new Query(); |
| 299 | 305 | $query->limit = self::INT_MAX_16BIT; |
| 300 | - if (isset($query->performCount)) $query->performCount = false; |
|
| 306 | + if (isset($query->performCount)) { |
|
| 307 | + $query->performCount = false; |
|
| 308 | + } |
|
| 301 | 309 | $query->filter = new Query\Criterion\ContentTypeId($contentTypeIds); |
| 302 | 310 | // sort objects by depth, lower to higher, so that deleting them has less chances of failure |
| 303 | 311 | // NB: we only do this in eZP versions that allow depth sorting on content queries |