1 | <?php |
||
20 | abstract class AbstractAction implements ActionInterface |
||
21 | { |
||
22 | /** |
||
23 | * @var ActionFactory |
||
24 | */ |
||
25 | protected $actionFactory; |
||
26 | |||
27 | /** |
||
28 | * @var ActionEventManager |
||
29 | */ |
||
30 | protected $eventManager; |
||
31 | |||
32 | /** |
||
33 | * @var ManagerRegistry |
||
34 | */ |
||
35 | protected $managerRegistry; |
||
36 | |||
37 | /** |
||
38 | * @var RouterInterface |
||
39 | */ |
||
40 | protected $router; |
||
41 | |||
42 | /** |
||
43 | * @var TranslatorInterface |
||
44 | */ |
||
45 | protected $translator; |
||
46 | |||
47 | /** |
||
48 | * @var ConfigurationInterface |
||
49 | */ |
||
50 | protected $configuration; |
||
51 | |||
52 | /** |
||
53 | * @var array |
||
54 | */ |
||
55 | protected $options; |
||
56 | |||
57 | /** |
||
58 | * @param ActionFactory $actionFactory |
||
59 | * @param ActionEventManager $eventManager |
||
60 | * @param ManagerRegistry $managerRegistry |
||
61 | * @param RouterInterface $router |
||
62 | * @param TranslatorInterface $translator |
||
63 | */ |
||
64 | public function __construct( |
||
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | public function setConfiguration(ConfigurationInterface $configuration) |
||
89 | |||
90 | /** |
||
91 | * {@inheritdoc} |
||
92 | */ |
||
93 | public function getConfiguration() |
||
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | public function getRoute() |
||
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | public function getRouteParameters($object = null) |
||
118 | |||
119 | /** |
||
120 | * {@inheritdoc} |
||
121 | */ |
||
122 | public function getOptions() |
||
126 | |||
127 | /** |
||
128 | * @param string $optionKey |
||
129 | * |
||
130 | * @return mixed |
||
131 | * @throws \LogicException |
||
132 | */ |
||
133 | protected function getOption($optionKey) |
||
143 | |||
144 | /** |
||
145 | * {@inheritdoc} |
||
146 | */ |
||
147 | public function execute(Request $request) |
||
154 | |||
155 | /** |
||
156 | * Set the default options |
||
157 | * |
||
158 | * @param OptionsResolver $resolver |
||
159 | */ |
||
160 | protected function setDefaultOptions(OptionsResolver $resolver) |
||
165 | |||
166 | /** |
||
167 | * Returns the url for a specified action |
||
168 | * |
||
169 | * @param string $actionType |
||
170 | * @param object $object |
||
171 | * @param array $parameters |
||
172 | * @param mixed $referenceType |
||
173 | */ |
||
174 | protected function getActionUrl( |
||
190 | |||
191 | /** |
||
192 | * Returns the entity of the request |
||
193 | * |
||
194 | * @param Request $request |
||
195 | * |
||
196 | * @throws NotFoundHttpException |
||
197 | * @return object |
||
198 | */ |
||
199 | protected function findEntity(Request $request) |
||
213 | |||
214 | /** |
||
215 | * Adds a flash message |
||
216 | * |
||
217 | * @param Request $request |
||
218 | * @param string $type |
||
219 | * @param string $message |
||
220 | * @param array $messageParameters |
||
221 | */ |
||
222 | protected function addFlash(Request $request, $type, $message, array $messageParameters = []) |
||
227 | |||
228 | /** |
||
229 | * Returns the custom entity manager |
||
230 | * |
||
231 | * @return \Pim\Bundle\CustomEntityBundle\Manager\ManagerInterface |
||
232 | */ |
||
233 | protected function getManager() |
||
237 | |||
238 | /** |
||
239 | * Executes the action |
||
240 | * |
||
241 | * @param Request $request |
||
242 | * |
||
243 | * @return \Symfony\Component\HttpFoundation\Response |
||
244 | */ |
||
245 | abstract public function doExecute(Request $request); |
||
246 | } |
||
247 |