1 | <?php |
||
22 | class SelectExclusionStrategy implements ExclusionStrategyInterface |
||
23 | { |
||
24 | /** |
||
25 | * @var RequestStack $requestStack |
||
26 | */ |
||
27 | protected $requestStack; |
||
28 | |||
29 | /** |
||
30 | * @var Boolean $isSelect |
||
31 | */ |
||
32 | protected $isSelect; |
||
33 | |||
34 | /** |
||
35 | * @var array $currentPath |
||
36 | */ |
||
37 | protected $currentPath; |
||
38 | |||
39 | /** |
||
40 | * @var array for selected tree level |
||
41 | */ |
||
42 | protected $selectTree = []; |
||
43 | |||
44 | /** |
||
45 | * SelectExclusionStrategy constructor. |
||
46 | * Comstructor Injection of the global request_stack to access the selected Fields via Query-Object |
||
47 | * @param RequestStack $requestStack the global request_stack |
||
48 | */ |
||
49 | public function __construct(RequestStack $requestStack) |
||
54 | |||
55 | /** |
||
56 | * Convert dot string to array. |
||
57 | * |
||
58 | * @param string $path string dotted array |
||
59 | * |
||
60 | * @return array |
||
61 | */ |
||
62 | private function createArrayByPath($path) |
||
73 | |||
74 | /** |
||
75 | * Initializing $this->selectedFields and $this->isSelect |
||
76 | * getting the fields that should be really serialized and setting the switch that there is actually a select |
||
77 | * called once in the object, so shouldSkipProperty can use the information for every field |
||
78 | * @return void |
||
79 | */ |
||
80 | private function createSelectionTreeFromRQL() |
||
102 | |||
103 | /** |
||
104 | * @InheritDoc: Whether the class should be skipped. |
||
105 | * @param ClassMetadata $metadata the ClassMetadata for the Class of the property to be serialized |
||
106 | * @param Context $navigatorContext the context for serialization |
||
107 | * @return boolean |
||
108 | */ |
||
109 | public function shouldSkipClass(ClassMetadata $metadata, Context $navigatorContext) |
||
113 | |||
114 | /** |
||
115 | * @InheritDoc: Whether the property should be skipped. |
||
116 | * Skipping properties who are not selected if there is a select in rql. |
||
117 | * @param PropertyMetadata $property the property to be serialized |
||
118 | * @param Context $context the context for serialization |
||
119 | * @return boolean |
||
120 | */ |
||
121 | public function shouldSkipProperty(PropertyMetadata $property, Context $context) |
||
156 | } |
||
157 |