1 | <?php |
||
25 | class AggregationHelper |
||
26 | { |
||
27 | /** |
||
28 | * @var DocumentEntity |
||
29 | */ |
||
30 | private $source; |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | private $schema = []; |
||
36 | |||
37 | /** |
||
38 | * @var ODMInterface |
||
39 | */ |
||
40 | protected $odm; |
||
41 | |||
42 | /** |
||
43 | * @param DocumentEntity $source |
||
44 | * @param array $schema DocumentEntity schema. |
||
45 | * @param ODMInterface $odm |
||
46 | */ |
||
47 | public function __construct(DocumentEntity $source, array $schema, ODMInterface $odm) |
||
53 | |||
54 | /** |
||
55 | * Create aggregation (one or many) based on given source values. |
||
56 | * |
||
57 | * @param string $aggregation |
||
58 | * |
||
59 | * @return DocumentSelector|CompositableInterface |
||
60 | * |
||
61 | * @throws AggregationException |
||
62 | */ |
||
63 | public function createAggregation(string $aggregation) |
||
89 | |||
90 | /** |
||
91 | * Configure DocumentSelector using aggregation schema. |
||
92 | * |
||
93 | * @param DocumentSelector $selector |
||
94 | * @param array $aggregation |
||
95 | * |
||
96 | * @return DocumentSelector |
||
97 | */ |
||
98 | protected function configureSelector( |
||
114 | |||
115 | /** |
||
116 | * Find field value using dot notation. |
||
117 | * |
||
118 | * @param string $name |
||
119 | * |
||
120 | * @return mixed|null |
||
121 | */ |
||
122 | private function findValue(string $name) |
||
154 | } |