@@ -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') { |
@@ -147,6 +147,9 @@ |
||
147 | 147 | return $refs; |
148 | 148 | } |
149 | 149 | |
150 | + /** |
|
151 | + * @param integer $status |
|
152 | + */ |
|
150 | 153 | protected function versionStatusToHash($status) |
151 | 154 | { |
152 | 155 | foreach(ContentVersionMatcher::STATUS_MAP as $own => $ez) { |
@@ -149,7 +149,7 @@ |
||
149 | 149 | |
150 | 150 | protected function versionStatusToHash($status) |
151 | 151 | { |
152 | - foreach(ContentVersionMatcher::STATUS_MAP as $own => $ez) { |
|
152 | + foreach (ContentVersionMatcher::STATUS_MAP as $own => $ez) { |
|
153 | 153 | if ($status == $ez) { |
154 | 154 | return $own; |
155 | 155 | } |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use eZ\Publish\API\Repository\Repository; |
6 | 6 | use eZ\Publish\API\Repository\Values\Content\Content; |
7 | 7 | use \eZ\Publish\API\Repository\Values\Content\VersionInfo; |
8 | -use eZ\Publish\Core\Base\Exceptions\NotFoundException; |
|
9 | 8 | use Kaliop\eZMigrationBundle\API\MatcherInterface; |
10 | 9 | use Kaliop\eZMigrationBundle\API\Collection\VersionInfoCollection; |
11 | 10 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $versions = array(); |
46 | 46 | |
47 | 47 | $contentCollection = $this->contentMatcher->match($contentConditions, $sort, $offset, $limit); |
48 | - foreach($contentCollection as $content) { |
|
48 | + foreach ($contentCollection as $content) { |
|
49 | 49 | $versions = array_merge($versions, $this->matchContentVersions($versionConditions, $content)); |
50 | 50 | } |
51 | 51 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | { |
152 | 152 | $versions = array(); |
153 | 153 | foreach ($this->findAllContentVersions($content) as $versionKey => $versionInfo) { |
154 | - foreach($values as $acceptedStatus) { |
|
154 | + foreach ($values as $acceptedStatus) { |
|
155 | 155 | if ($versionInfo->status == self::STATUS_MAP[$acceptedStatus]) { |
156 | 156 | $versions[$versionKey] = $versionInfo; |
157 | 157 | break; |
@@ -173,15 +173,15 @@ discard block |
||
173 | 173 | $contentVersionsCount = count($contentVersions); |
174 | 174 | $i = 0; |
175 | 175 | foreach ($contentVersions as $versionKey => $versionInfo) { |
176 | - foreach($values as $acceptedVersionNo) { |
|
177 | - if ($acceptedVersionNo > 0 ) { |
|
176 | + foreach ($values as $acceptedVersionNo) { |
|
177 | + if ($acceptedVersionNo > 0) { |
|
178 | 178 | if ($acceptedVersionNo == $versionInfo->versionNo) { |
179 | 179 | $versions[$versionKey] = $versionInfo; |
180 | 180 | break; |
181 | 181 | } |
182 | 182 | } else { |
183 | 183 | // negative $acceptedVersionNo means 'leave the last X versions', eg: -1 = leave the last version |
184 | - if ($i < $contentVersionsCount + $acceptedVersionNo) { |
|
184 | + if ($i < $contentVersionsCount + $acceptedVersionNo) { |
|
185 | 185 | $versions[$versionKey] = $versionInfo; |
186 | 186 | break; |
187 | 187 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $contentVersions = $this->repository->getContentService()->loadVersions($content->contentInfo); |
203 | 203 | // different eZ kernels apparently sort versions in different order... |
204 | 204 | $sortedVersions = array(); |
205 | - foreach($contentVersions as $versionInfo) { |
|
205 | + foreach ($contentVersions as $versionInfo) { |
|
206 | 206 | $sortedVersions[$content->contentInfo->id . '/' . $versionInfo->versionNo] = $versionInfo; |
207 | 207 | } |
208 | 208 | ksort($sortedVersions); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * Like match, but will throw an exception if there are 0 or more than 1 items matching |
57 | 57 | * |
58 | - * @param array $conditions |
|
58 | + * @param array $contentConditions |
|
59 | 59 | * @return mixed |
60 | 60 | * @throws \Exception |
61 | 61 | */ |
@@ -107,6 +107,9 @@ discard block |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | + /** |
|
111 | + * @param Content $content |
|
112 | + */ |
|
110 | 113 | protected function matchAnd(array $conditionsArray, $content = null) |
111 | 114 | { |
112 | 115 | /// @todo introduce proper re-validation of all child conditions |
@@ -130,6 +133,9 @@ discard block |
||
130 | 133 | return $results; |
131 | 134 | } |
132 | 135 | |
136 | + /** |
|
137 | + * @param Content $content |
|
138 | + */ |
|
133 | 139 | protected function matchOr(array $conditionsArray, $content = null) |
134 | 140 | { |
135 | 141 | /// @todo introduce proper re-validation of all child conditions |