1 | <?php |
||
39 | abstract class AbstractController extends BaseController { |
||
40 | |||
41 | /** |
||
42 | * Dispatch an event. |
||
43 | * |
||
44 | * @param string $eventName The event name. |
||
45 | * @param BaseEvent $event The event. |
||
46 | * @return BaseEvent|null Returns the event in case of success, null otherwise. |
||
47 | */ |
||
48 | protected function dispatchEvent($eventName, BaseEvent $event) { |
||
51 | |||
52 | /** |
||
53 | * Get the container. |
||
54 | * |
||
55 | * @return Container Returns the container. |
||
56 | */ |
||
57 | protected function getContainer() { |
||
60 | |||
61 | /** |
||
62 | * Get the event dispatcher. |
||
63 | * |
||
64 | * @return EventDispatcherInterface Returns the event dispatcher. |
||
65 | */ |
||
66 | protected function getEventDispatcher() { |
||
69 | |||
70 | /** |
||
71 | * Get the form helper. |
||
72 | * |
||
73 | * @return FormHelper Returns the form helper. |
||
74 | */ |
||
75 | protected function getFormHelper() { |
||
78 | |||
79 | /** |
||
80 | * Get the kernel event listener. |
||
81 | * |
||
82 | * @return KernelEventListener Returns the kernel event listener. |
||
83 | */ |
||
84 | protected function getKernelEventListener() { |
||
87 | |||
88 | /** |
||
89 | * Get the logger. |
||
90 | * |
||
91 | * @return LoggerInterface Returns the logger. |
||
92 | */ |
||
93 | protected function getLogger() { |
||
96 | |||
97 | /** |
||
98 | * Get the router. |
||
99 | * |
||
100 | * @return RouterInterface Returns the router. |
||
101 | */ |
||
102 | protected function getRouter() { |
||
105 | |||
106 | /** |
||
107 | * Get the session. |
||
108 | * |
||
109 | * @return SessionInterface Returns the session. |
||
110 | */ |
||
111 | protected function getSession() { |
||
114 | |||
115 | /** |
||
116 | * Get the translator. |
||
117 | * |
||
118 | * @return TranslatorInterface Returns the translator. |
||
119 | */ |
||
120 | protected function getTranslator() { |
||
123 | |||
124 | /** |
||
125 | * Determines if the connected user have roles or redirect. |
||
126 | * |
||
127 | * @param array $roles The roles. |
||
128 | * @param bool $or OR ? |
||
129 | * @param string $redirectUrl The redirect URL. |
||
130 | * @param string $originUrl The origin URL. |
||
131 | * @return bool Returns true. |
||
132 | * @throws BadUserRoleException Throws a bad user role exception. |
||
133 | */ |
||
134 | protected function hasRolesOrRedirect(array $roles, $or, $redirectUrl, $originUrl = "") { |
||
146 | |||
147 | /** |
||
148 | * Notify. |
||
149 | * |
||
150 | * @param string $eventName The event name. |
||
151 | * @param NotificationInterface $notification The notification. |
||
152 | * @return NotificationEvent|null Returns the event in case of success, null otherwise. |
||
153 | */ |
||
154 | protected function notify($eventName, NotificationInterface $notification) { |
||
158 | |||
159 | /** |
||
160 | * Toast. |
||
161 | * |
||
162 | * @param string $eventName The event name. |
||
163 | * @param ToastInterface $toast The toast. |
||
164 | * @return ToastEvent|null Returns the event in case of success, null otherwise. |
||
165 | */ |
||
166 | protected function toast($eventName, ToastInterface $toast) { |
||
170 | } |
||
171 |