1 | <?php |
||
12 | final class SearchDehydrator |
||
13 | { |
||
14 | /** @var ApiMetadata */ |
||
15 | private $metadata; |
||
16 | /** @var ApiEntityManager */ |
||
17 | private $manager; |
||
18 | |||
19 | /** |
||
20 | * SearchDehydrator constructor. |
||
21 | * |
||
22 | * @param ApiMetadata $metadata |
||
23 | * @param ApiEntityManager $manager |
||
24 | */ |
||
25 | 23 | public function __construct(ApiMetadata $metadata, ApiEntityManager $manager) |
|
30 | |||
31 | /** |
||
32 | * Converts doctrine object identifiers to API-ready criteria (converts types and field names) |
||
33 | * |
||
34 | * @param object $entity |
||
35 | * |
||
36 | * @return array API-ready identifier criteria |
||
37 | */ |
||
38 | 3 | public function transformIdentifier($entity) |
|
42 | |||
43 | /** |
||
44 | * Converts doctrine entity criteria to API-ready criteria (converts types and field names) |
||
45 | * Appends discriminator for searching |
||
46 | * |
||
47 | * @param array $criteria |
||
48 | * |
||
49 | * @return array API-ready criteria |
||
50 | */ |
||
51 | 8 | public function transformCriteria(array $criteria) |
|
67 | |||
68 | /** |
||
69 | * Converts doctrine entity criteria to API-ready criteria (converts types and field names) |
||
70 | * |
||
71 | * @param array $criteria |
||
72 | * |
||
73 | * @return array API-ready criteria |
||
74 | */ |
||
75 | 12 | public function transformFields(array $criteria) |
|
79 | |||
80 | /** |
||
81 | * Converts doctrine entity order to API-ready order (converts field names) |
||
82 | * |
||
83 | * @param array $orderBy |
||
84 | * |
||
85 | * @return array API-ready order |
||
86 | */ |
||
87 | 7 | public function transformOrder(array $orderBy = null) |
|
96 | |||
97 | 20 | private function doTransform(array $criteria) |
|
153 | } |
||
154 |