1 | <?php |
||
37 | abstract class AbstractController extends BaseController { |
||
38 | |||
39 | /** |
||
40 | * Dispatch an event. |
||
41 | * |
||
42 | * @param string $eventName The event name. |
||
43 | * @param BaseEvent $event The event. |
||
44 | * @return BaseEvent|null Returns the event in case of success, null otherwise. |
||
45 | */ |
||
46 | protected function dispatchEvent($eventName, BaseEvent $event) { |
||
59 | |||
60 | /** |
||
61 | * Get the container. |
||
62 | * |
||
63 | * @return Container Returns the container. |
||
64 | */ |
||
65 | protected function getContainer() { |
||
68 | |||
69 | /** |
||
70 | * Get the event dispatcher. |
||
71 | * |
||
72 | * @return EventDispatcherInterface Returns the event dispatcher. |
||
73 | */ |
||
74 | protected function getEventDispatcher() { |
||
77 | |||
78 | /** |
||
79 | * Get the form helper. |
||
80 | * |
||
81 | * @return FormHelper Returns the form helper. |
||
82 | */ |
||
83 | protected function getFormHelper() { |
||
86 | |||
87 | /** |
||
88 | * Get the kernel event listener. |
||
89 | * |
||
90 | * @return KernelEventListener Returns the kernel event listener. |
||
91 | */ |
||
92 | protected function getKernelEventListener() { |
||
95 | |||
96 | /** |
||
97 | * Get the logger. |
||
98 | * |
||
99 | * @return LoggerInterface Returns the logger. |
||
100 | */ |
||
101 | protected function getLogger() { |
||
104 | |||
105 | /** |
||
106 | * Get the router. |
||
107 | * |
||
108 | * @return RouterInterface Returns the router. |
||
109 | */ |
||
110 | protected function getRouter() { |
||
113 | |||
114 | /** |
||
115 | * Get the session. |
||
116 | * |
||
117 | * @return SessionInterface Returns the session. |
||
118 | */ |
||
119 | protected function getSession() { |
||
122 | |||
123 | /** |
||
124 | * Get the translator. |
||
125 | * |
||
126 | * @return TranslatorInterface Returns the translator. |
||
127 | */ |
||
128 | protected function getTranslator() { |
||
131 | |||
132 | /** |
||
133 | * Determines if the connected user have roles or redirect. |
||
134 | * |
||
135 | * @param array $roles The roles. |
||
136 | * @param bool $or OR ? |
||
137 | * @param string $redirectUrl The redirect URL. |
||
138 | * @param string $originUrl The origin URL. |
||
139 | * @return bool Returns true. |
||
140 | * @throws BadUserRoleException Throws a bad user role exception. |
||
141 | */ |
||
142 | protected function hasRolesOrRedirect(array $roles, $or, $redirectUrl, $originUrl = "") { |
||
154 | |||
155 | /** |
||
156 | * Notify. |
||
157 | * |
||
158 | * @param string $eventName The event name. |
||
159 | * @param NotificationInterface $notification The notification. |
||
160 | * @return NotificationEvent|null Returns the event in case of success, null otherwise. |
||
161 | */ |
||
162 | protected function notify($eventName, NotificationInterface $notification) { |
||
166 | } |
||
167 |