Conditions | 4 |
Paths | 3 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
34 | protected function filterDataByValidationGroups(array $datas, array $validation_groups, AbstractEntity $entity) |
||
35 | { |
||
36 | $entity_members_metadatas = $this->validator->getMetadataFor($entity)->members; |
||
37 | $filtered_datas = []; |
||
38 | |||
39 | foreach ($entity_members_metadatas as $field_name => $all_field_metadatas) { |
||
40 | $constraints = array_shift($all_field_metadatas); |
||
41 | $field_validation_groups = array_keys($constraints->constraintsByGroup); |
||
42 | $is_field_concerned = !empty(array_intersect($validation_groups, $field_validation_groups)); |
||
43 | |||
44 | if ($is_field_concerned && isset($datas[$field_name])) { |
||
45 | $filtered_datas[$field_name] = $datas[$field_name]; |
||
46 | } |
||
47 | } |
||
48 | return $filtered_datas; |
||
49 | } |
||
50 | } |
||
51 |