@@ 158-168 (lines=11) @@ | ||
155 | } |
|
156 | ||
157 | $invalidFields = array_diff($fields, $this->getSortableFields()); |
|
158 | if (count($invalidFields) > 0) { |
|
159 | $this->addViolation( |
|
160 | $context, |
|
161 | 'Sorting by following fields is not supported: %fields%', |
|
162 | ['%fields%' => sprintf("'%s'", implode("', '", $invalidFields))], |
|
163 | $invalidFields, |
|
164 | self::INVALID_SORTING, |
|
165 | 'sortParameters', |
|
166 | count($invalidFields) |
|
167 | ); |
|
168 | } |
|
169 | } |
|
170 | ||
171 | /** |
@@ 225-235 (lines=11) @@ | ||
222 | foreach ($this->fieldSets as $resource => $fields) { |
|
223 | $invalidFields = array_diff($fields, $this->getAllowedFields($resource)); |
|
224 | ||
225 | if (count($invalidFields) > 0) { |
|
226 | $this->addViolation( |
|
227 | $context, |
|
228 | 'Invalid fields: %fields%', |
|
229 | ['%fields%' => sprintf("'%s'", implode("', '", $invalidFields))], |
|
230 | $invalidFields, |
|
231 | self::INVALID_FIELD_SET, |
|
232 | 'fieldSets.' . $resource, |
|
233 | count($invalidFields) |
|
234 | ); |
|
235 | } |
|
236 | } |
|
237 | } |
|
238 |