1 | <?php |
||
40 | abstract class AbstractController extends BaseController { |
||
41 | |||
42 | /** |
||
43 | * Dispatch an event. |
||
44 | * |
||
45 | * @param string $eventName The event name. |
||
46 | * @param BaseEvent $event The event. |
||
47 | * @return BaseEvent|null Returns the event in case of success, null otherwise. |
||
48 | */ |
||
49 | protected function dispatchEvent($eventName, BaseEvent $event) { |
||
53 | |||
54 | /** |
||
55 | * Get the container. |
||
56 | * |
||
57 | * @return Container|null Returns the container in case of success, null otherwise. |
||
58 | */ |
||
59 | protected function getContainer() { |
||
62 | |||
63 | /** |
||
64 | * Get the event dispatcher. |
||
65 | * |
||
66 | * @return EventDispatcherInterface|null Returns the event dispatcher in case of success, null otherwise. |
||
67 | */ |
||
68 | protected function getEventDispatcher() { |
||
71 | |||
72 | /** |
||
73 | * Get the form helper. |
||
74 | * |
||
75 | * @return FormHelper|null Returns the form helper in case of success, null otherwise. |
||
76 | */ |
||
77 | protected function getFormHelper() { |
||
80 | |||
81 | /** |
||
82 | * Get the kernel event listener. |
||
83 | * |
||
84 | * @return KernelEventListener|null Returns the kernel event listener in case of success, null otherwise. |
||
85 | */ |
||
86 | protected function getKernelEventListener() { |
||
89 | |||
90 | /** |
||
91 | * Get the logger. |
||
92 | * |
||
93 | * @return LoggerInterface|null Returns the logger in case of success, null otherwise. |
||
94 | */ |
||
95 | protected function getLogger() { |
||
98 | |||
99 | /** |
||
100 | * Get the repository report helper. |
||
101 | * |
||
102 | * @return RepositoryReportHelper|null Returns the repository report helper in case of success, null otherwise. |
||
103 | */ |
||
104 | protected function getRepositoryReportHelper() { |
||
107 | |||
108 | /** |
||
109 | * Get the router. |
||
110 | * |
||
111 | * @return RouterInterface|null Returns the router in case of success, null otherwise. |
||
112 | */ |
||
113 | protected function getRouter() { |
||
116 | |||
117 | /** |
||
118 | * Get the session. |
||
119 | * |
||
120 | * @return SessionInterface|null Returns the session in case of success, null otherwise. |
||
121 | */ |
||
122 | protected function getSession() { |
||
125 | |||
126 | /** |
||
127 | * Get the translator. |
||
128 | * |
||
129 | * @return TranslatorInterface|null Returns the translator in case of success, null otherwise. |
||
130 | */ |
||
131 | protected function getTranslator() { |
||
134 | |||
135 | /** |
||
136 | * Determines if the connected user have roles or redirect. |
||
137 | * |
||
138 | * @param array $roles The roles. |
||
139 | * @param bool $or OR ? |
||
140 | * @param string $redirectUrl The redirect URL. |
||
141 | * @param string $originUrl The origin URL. |
||
142 | * @return bool Returns true. |
||
143 | * @throws BadUserRoleException Throws a bad user role exception. |
||
144 | */ |
||
145 | protected function hasRolesOrRedirect(array $roles, $or, $redirectUrl, $originUrl = "") { |
||
157 | |||
158 | /** |
||
159 | * Notify. |
||
160 | * |
||
161 | * @param string $eventName The event name. |
||
162 | * @param NotificationInterface $notification The notification. |
||
163 | * @return NotificationEvent|null Returns the event in case of success, null otherwise. |
||
164 | */ |
||
165 | protected function notify($eventName, NotificationInterface $notification) { |
||
168 | |||
169 | /** |
||
170 | * Toast. |
||
171 | * |
||
172 | * @param string $eventName The event name. |
||
173 | * @param ToastInterface $toast The toast. |
||
174 | * @return ToastEvent|null Returns the event in case of success, null otherwise. |
||
175 | */ |
||
176 | protected function toast($eventName, ToastInterface $toast) { |
||
179 | } |
||
180 |