| @@ 38-71 (lines=34) @@ | ||
| 35 | * @return ContentCollection |
|
| 36 | * @throws \Exception |
|
| 37 | */ |
|
| 38 | protected function matchContents($action) |
|
| 39 | { |
|
| 40 | if (!isset($this->dsl['object_id']) && !isset($this->dsl['remote_id']) && !isset($this->dsl['match'])) { |
|
| 41 | throw new \Exception("The ID or remote ID of an object or a Match Condition is required to $action a new location."); |
|
| 42 | } |
|
| 43 | ||
| 44 | // Backwards compat |
|
| 45 | if (!isset($this->dsl['match'])) { |
|
| 46 | if (isset($this->dsl['object_id'])) { |
|
| 47 | $this->dsl['match'] = array('content_id' => $this->dsl['object_id']); |
|
| 48 | } elseif (isset($this->dsl['remote_id'])) { |
|
| 49 | $this->dsl['match'] = array('content_remote_id' => $this->dsl['remote_id']); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| 53 | $match = $this->dsl['match']; |
|
| 54 | ||
| 55 | // convert the references passed in the match |
|
| 56 | foreach ($match as $condition => $values) { |
|
| 57 | if (is_array($values)) { |
|
| 58 | foreach ($values as $position => $value) { |
|
| 59 | if ($this->referenceResolver->isReference($value)) { |
|
| 60 | $match[$condition][$position] = $this->referenceResolver->getReferenceValue($value); |
|
| 61 | } |
|
| 62 | } |
|
| 63 | } else { |
|
| 64 | if ($this->referenceResolver->isReference($values)) { |
|
| 65 | $match[$condition] = $this->referenceResolver->getReferenceValue($values); |
|
| 66 | } |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||
| 70 | return $this->contentMatcher->matchContent($match); |
|
| 71 | } |
|
| 72 | ||
| 73 | /** |
|
| 74 | * Handle the content create migration action type |
|
| @@ 179-212 (lines=34) @@ | ||
| 176 | * @return ContentCollection |
|
| 177 | * @throws \Exception |
|
| 178 | */ |
|
| 179 | protected function matchContents($action) |
|
| 180 | { |
|
| 181 | if (!isset($this->dsl['object_id']) && !isset($this->dsl['remote_id']) && !isset($this->dsl['match'])) { |
|
| 182 | throw new \Exception("The ID or remote ID of an object or a Match Condition is required to $action a new location."); |
|
| 183 | } |
|
| 184 | ||
| 185 | // Backwards compat |
|
| 186 | if (!isset($this->dsl['match'])) { |
|
| 187 | if (isset($this->dsl['object_id'])) { |
|
| 188 | $this->dsl['match'] = array('content_id' => $this->dsl['object_id']); |
|
| 189 | } elseif (isset($this->dsl['remote_id'])) { |
|
| 190 | $this->dsl['match'] = array('content_remote_id' => $this->dsl['remote_id']); |
|
| 191 | } |
|
| 192 | } |
|
| 193 | ||
| 194 | $match = $this->dsl['match']; |
|
| 195 | ||
| 196 | // convert the references passed in the match |
|
| 197 | foreach ($match as $condition => $values) { |
|
| 198 | if (is_array($values)) { |
|
| 199 | foreach ($values as $position => $value) { |
|
| 200 | if ($this->referenceResolver->isReference($value)) { |
|
| 201 | $match[$condition][$position] = $this->referenceResolver->getReferenceValue($value); |
|
| 202 | } |
|
| 203 | } |
|
| 204 | } else { |
|
| 205 | if ($this->referenceResolver->isReference($values)) { |
|
| 206 | $match[$condition] = $this->referenceResolver->getReferenceValue($values); |
|
| 207 | } |
|
| 208 | } |
|
| 209 | } |
|
| 210 | ||
| 211 | return $this->contentMatcher->matchContent($match); |
|
| 212 | } |
|
| 213 | ||
| 214 | protected function getSortField($currentValue = null) |
|
| 215 | { |
|