1 | <?php |
||
18 | trait ControllerBasicFeaturesTrait |
||
19 | { |
||
20 | /** |
||
21 | * Gets a container service by its id. |
||
22 | * |
||
23 | * @param string $id The service id |
||
24 | * |
||
25 | * @return object The service |
||
26 | */ |
||
27 | abstract protected function get($id); |
||
28 | |||
29 | /** |
||
30 | * Creates and returns a Form instance from the type of the form. |
||
31 | * |
||
32 | * @param string $type The fully qualified class name of the form type |
||
33 | * @param mixed $data The initial data for the form |
||
34 | * @param array $options Options for the form |
||
35 | * |
||
36 | * @return Form |
||
37 | */ |
||
38 | abstract protected function createForm($type, $data = null, array $options = []); |
||
39 | |||
40 | /** |
||
41 | * @param Request $request |
||
42 | * @param string $repositoryName |
||
43 | * |
||
44 | * @return PaginatedRepresentation |
||
45 | */ |
||
46 | 1 | protected function getCollectionPaginated(Request $request, $repositoryName) |
|
69 | |||
70 | /** |
||
71 | * @param Request $request |
||
72 | * @param string $repositoryName |
||
73 | * |
||
74 | * @return mixed|\FOS\RestBundle\View\View |
||
75 | */ |
||
76 | 2 | protected function getAnElement(Request $request, $repositoryName) |
|
88 | |||
89 | /** |
||
90 | * @param Request $request |
||
91 | * @param mixed $element |
||
92 | * @param string $formClassName |
||
93 | * |
||
94 | * @return mixed |
||
95 | */ |
||
96 | 2 | protected function createAnElement(Request $request, $element, $formClassName) |
|
104 | |||
105 | /** |
||
106 | * @param Request $request |
||
107 | * @param string $repositoryName |
||
108 | */ |
||
109 | 2 | protected function removeAnElement(Request $request, $repositoryName) |
|
120 | |||
121 | /** |
||
122 | * @param Request $request |
||
123 | * @param bool $clearMissing |
||
124 | * @param $repositoryName |
||
125 | * @param $formClassName |
||
126 | * |
||
127 | * @return mixed|Form|\FOS\RestBundle\View\View |
||
128 | */ |
||
129 | 6 | protected function updateAnElement(Request $request, $clearMissing, $repositoryName, $formClassName) |
|
145 | |||
146 | /** |
||
147 | * @param Form $form |
||
148 | * @param mixed $element |
||
149 | * |
||
150 | * @return mixed|Form |
||
151 | */ |
||
152 | 6 | private function checkFormAndPersist(Form $form, $element) |
|
164 | } |
||
165 |