1 | <?php |
||
13 | trait ControllerTrait |
||
14 | { |
||
15 | /** |
||
16 | * return controller security mapping as "intention" => "credentials" |
||
17 | * |
||
18 | * @example : |
||
19 | * return array( |
||
20 | * 'list' => array('fetch'), |
||
21 | * 'get' => array('read'), |
||
22 | * 'create' => array('write'), |
||
23 | * 'udpate' => array('write') |
||
24 | * ); |
||
25 | * |
||
26 | * @see ControllerTrait::checkSecurity() |
||
27 | * |
||
28 | * @return array |
||
29 | */ |
||
30 | protected function getSecurityMapping() |
||
34 | |||
35 | /** |
||
36 | * checks security for given intention |
||
37 | * |
||
38 | * @param string $intention |
||
39 | * @param mixed $resource |
||
40 | * |
||
41 | * @return boolean |
||
42 | */ |
||
43 | protected function checkSecurity($intention, $resource = null) |
||
55 | |||
56 | /** |
||
57 | * Extract available query filter from request. |
||
58 | * |
||
59 | * @param Request $request |
||
60 | * |
||
61 | * @return array |
||
62 | */ |
||
63 | protected function extractQueryFilter(Request $request) |
||
74 | |||
75 | /** |
||
76 | * Retrieves entity for given id into given repository service. |
||
77 | * |
||
78 | * @param $entityId |
||
79 | * @param $loaderId |
||
80 | * |
||
81 | * @return Object |
||
82 | * |
||
83 | * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException |
||
84 | */ |
||
85 | protected function retrieveOr404($entityId, $loaderId) |
||
99 | |||
100 | /** |
||
101 | * create a formatted http not found exception. |
||
102 | * |
||
103 | * @param string $entityId |
||
104 | * @param string $loaderId |
||
105 | * |
||
106 | * @return NotFoundHttpException |
||
107 | */ |
||
108 | protected function create404($entityId, $loaderId) |
||
117 | } |
||
118 |