1 | <?php |
||
29 | abstract class AbstractController extends Controller |
||
30 | { |
||
31 | /** |
||
32 | * Lists all items entity. |
||
33 | * |
||
34 | * @param string $entityName Name of Entity |
||
35 | * @param string $prefixRoute prefix_route |
||
36 | * @param \Symfony\Component\HttpFoundation\Request $request Sort request |
||
37 | * @return array |
||
38 | */ |
||
39 | public function abstractIndexAction($entityName, $prefixRoute, Request $request = null) |
||
53 | |||
54 | /** |
||
55 | * Finds and displays an item entity. |
||
56 | * |
||
57 | * @param Object $entity Entity |
||
58 | * @param string $prefixRoute prefix_route |
||
59 | * @return array |
||
60 | */ |
||
61 | public function abstractShowAction($entity, $prefixRoute) |
||
67 | |||
68 | /** |
||
69 | * Displays a form to create a new item entity. |
||
70 | * |
||
71 | * @param string $entityName Name of Entity |
||
72 | * @param string $entityPath Path of Entity |
||
73 | * @param string $typePath Path of FormType |
||
74 | * @param string $prefixRoute Prefix of Route |
||
75 | * @return array |
||
76 | */ |
||
77 | public function abstractNewAction($entityName, $entityPath, $typePath, $prefixRoute) |
||
97 | |||
98 | /** |
||
99 | * Creates a new item entity. |
||
100 | * |
||
101 | * @param \Symfony\Component\HttpFoundation\Request $request Request in progress |
||
102 | * @param string $entityName Entity name <i>First letter Upper</i> |
||
103 | * @param string $entityPath Path of Entity |
||
104 | * @param string $typePath Path of FormType |
||
105 | * @param string $prefixRoute Prefix of route |
||
106 | * @return array |
||
107 | */ |
||
108 | public function abstractCreateAction(Request $request, $entityName, $entityPath, $typePath, $prefixRoute) |
||
132 | |||
133 | /** |
||
134 | * Displays a form to edit an existing item entity. |
||
135 | * |
||
136 | * @param Object $entity Entity |
||
137 | * @param string $prefixRoute Prefix of Route |
||
138 | * @param string $typePath Path of FormType |
||
139 | * @return array |
||
140 | */ |
||
141 | public function abstractEditAction($entity, $prefixRoute, $typePath) |
||
156 | |||
157 | /** |
||
158 | * Edits an existing item entity. |
||
159 | * |
||
160 | * @param Object $entity Entity |
||
161 | * @param \Symfony\Component\HttpFoundation\Request $request Request in progress |
||
162 | * @param string $prefixRoute Prefix of Route |
||
163 | * @param string $typePath Path of FormType |
||
164 | * @return array |
||
165 | */ |
||
166 | public function abstractUpdateAction($entity, Request $request, $prefixRoute, $typePath) |
||
191 | |||
192 | /** |
||
193 | * Deletes an item entity. |
||
194 | * |
||
195 | * @param Object $entity Entity |
||
196 | * @param \Symfony\Component\HttpFoundation\Request $request Request in progress |
||
197 | * @param string $prefixRoute Prefix of Route |
||
198 | * @return array |
||
199 | */ |
||
200 | public function abstractDeleteAction($entity, Request $request, $prefixRoute) |
||
209 | |||
210 | /** |
||
211 | * Deletes a item entity with Articles. |
||
212 | * |
||
213 | * @param Object $entity Entity |
||
214 | * @param \Symfony\Component\HttpFoundation\Request $request Request in progress |
||
215 | * @param string $entityName Name of Entity |
||
216 | * @param string $prefixRoute Prefix of Route |
||
217 | * @return array |
||
218 | */ |
||
219 | public function abstractDeleteWithArticlesAction($entity, Request $request, $entityName, $prefixRoute) |
||
237 | |||
238 | /** |
||
239 | * AddQueryBuilderSort for the SortAction in views. |
||
240 | * |
||
241 | * @param QueryBuilder $qbd |
||
242 | * @param string $name |
||
243 | */ |
||
244 | protected function addQueryBuilderSort(QueryBuilder $qbd, $name) |
||
262 | |||
263 | /** |
||
264 | * Create Delete form. |
||
265 | * |
||
266 | * @param int $id |
||
267 | * @param string $route |
||
268 | * |
||
269 | * @return \Symfony\Component\Form\Form |
||
270 | */ |
||
271 | protected function createDeleteForm($id, $route) |
||
279 | |||
280 | /** |
||
281 | * Test paramters to return. |
||
282 | * |
||
283 | * @param object $entity Entity to return |
||
284 | * @param string $prefixRoute Entity name to test |
||
285 | * @return array Parameters to return |
||
286 | */ |
||
287 | protected function testReturnParam($entity, $prefixRoute) |
||
298 | |||
299 | /** |
||
300 | * Get the existing roles |
||
301 | * |
||
302 | * @return array Array of roles |
||
303 | */ |
||
304 | private function getExistingRoles() |
||
315 | |||
316 | /** |
||
317 | * Add roles to form |
||
318 | * |
||
319 | * @param \Symfony\Component\Form\Form $form The form in which to insert the roles |
||
320 | * @param \AppBundle\Entity\Staff\Group $group The entity to deal |
||
321 | * @return \Symfony\Component\Form\Form The form |
||
322 | */ |
||
323 | public function addRolesAction($form, $group) |
||
331 | |||
332 | /** |
||
333 | * Get the entity. |
||
334 | * |
||
335 | * @param string $entityName Name of Entity |
||
336 | * @param \Doctrine\Common\Persistence\ObjectManager $etm ObjectManager instances |
||
337 | * @return array|\Doctrine\ORM\QueryBuilder|null Entity elements |
||
338 | */ |
||
339 | private function getEntity($entityName, ObjectManager $etm) |
||
355 | } |
||
356 |