1 | <?php |
||
20 | trait IntegrationModuleTrait |
||
21 | { |
||
22 | /** |
||
23 | * @see \Zend\EventManager\EventManagerAwareTrait::setEventManager |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $eventIdentifier = [ |
||
28 | IntegrationModuleInterface::class |
||
29 | ]; |
||
30 | |||
31 | /** |
||
32 | * Протип объекта, испольуземый для создания события бросаемого при инициализации интеграционного модуля |
||
33 | * |
||
34 | * @var IntegrationModuleEventInterface |
||
35 | */ |
||
36 | protected $prototypeIntegrationModuleEvent; |
||
37 | |||
38 | /** |
||
39 | * Имя класса, который должен имплементировать \Nnx\Module\Event\IntegrationModuleEventInterface. Данный класс |
||
40 | * используется для создания объекта прототипа события (@see \Nnx\Module\IntegrationModuleTrait::$prototypeIntegrationModuleEvent) |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $prototypeIntegrationModuleEventClassName = IntegrationModuleEvent::class; |
||
45 | |||
46 | /** |
||
47 | * Менеджер модулей |
||
48 | * |
||
49 | * @var ModuleManagerInterface |
||
50 | */ |
||
51 | protected $moduleManager; |
||
52 | |||
53 | /** |
||
54 | * Приоритет обработчки отвечающего за проксирование события пост загрузки всех модулей. Для корректной работы |
||
55 | * интеграционного модуля, это значение должно быть больше, по приоритету чем значение свойства |
||
56 | * @see \Nnx\Module\Listener\IntegrationModuleListener::$configuringServiceModulesHandlerPriority |
||
57 | * |
||
58 | * |
||
59 | * при подписке на onLoadModulesPost в ServiceListener |
||
60 | * (@see \Zend\ModuleManager\Listener\ServiceListener::attach) и меньше чем |
||
61 | * |
||
62 | * |
||
63 | * |
||
64 | * @var int |
||
65 | */ |
||
66 | protected $loadModulesPostProxyHandlerPriority = 100; |
||
67 | |||
68 | /** |
||
69 | * @return EventManagerInterface |
||
70 | */ |
||
71 | abstract public function getEventManager(); |
||
72 | |||
73 | /** |
||
74 | * Initialize workflow |
||
75 | * |
||
76 | * @param ModuleManagerInterface $manager |
||
77 | * @return void |
||
78 | */ |
||
79 | public function init(ModuleManagerInterface $manager) |
||
83 | |||
84 | /** |
||
85 | * Инициализация интеграционного модуля |
||
86 | * |
||
87 | * @param ModuleManagerInterface $manager |
||
88 | */ |
||
89 | public function initIntegrationModule(ModuleManagerInterface $manager) |
||
100 | |||
101 | /** |
||
102 | * Метод вызывается перед стандартным механизмом инициализаци. Используется для перегрузки в конкретном модуле. |
||
103 | * |
||
104 | * @return void |
||
105 | */ |
||
106 | protected function preInitIntegrationModule() |
||
109 | |||
110 | /** |
||
111 | * Обработчик события возникающего после загрузки модулей |
||
112 | * |
||
113 | * @throws Exception\ErrorCreateIntegrationModuleEventException |
||
114 | * |
||
115 | * @throws Exception\InvalidModuleManagerException |
||
116 | */ |
||
117 | public function onLoadModulesPostProxyHandler() |
||
130 | |||
131 | /** |
||
132 | * Возвращает протип объекта, испольуземый для создания события бросаемого при инициализации интеграционного модуля |
||
133 | * |
||
134 | * @return IntegrationModuleEventInterface |
||
135 | * |
||
136 | * @throws Exception\ErrorCreateIntegrationModuleEventException |
||
137 | */ |
||
138 | public function getPrototypeIntegrationModuleEvent() |
||
158 | |||
159 | /** |
||
160 | * Устанавливает протип объекта, испольуземый для создания события бросаемого при инициализации интеграционного модуля |
||
161 | * |
||
162 | * @param IntegrationModuleEventInterface $prototypeIntegrationModuleEvent |
||
163 | * |
||
164 | * @return $this |
||
165 | */ |
||
166 | public function setPrototypeIntegrationModuleEvent(IntegrationModuleEventInterface $prototypeIntegrationModuleEvent) |
||
172 | |||
173 | /** |
||
174 | * Возвращает имя класса, который должен имплементировать \Nnx\Module\Event\IntegrationModuleEventInterface. Данный класс |
||
175 | * используется для создания объекта прототипа события (@see \Nnx\Module\IntegrationModuleTrait::$prototypeIntegrationModuleEvent) |
||
176 | * |
||
177 | * @return string |
||
178 | */ |
||
179 | public function getPrototypeIntegrationModuleEventClassName() |
||
183 | |||
184 | /** |
||
185 | * Устанавливает имя класса, который должен имплементировать \Nnx\Module\Event\IntegrationModuleEventInterface. Данный класс |
||
186 | * используется для создания объекта прототипа события (@see \Nnx\Module\IntegrationModuleTrait::$prototypeIntegrationModuleEvent) |
||
187 | * |
||
188 | * @param string $prototypeIntegrationModuleEventClassName |
||
189 | * |
||
190 | * @return $this |
||
191 | */ |
||
192 | public function setPrototypeIntegrationModuleEventClassName($prototypeIntegrationModuleEventClassName) |
||
198 | |||
199 | /** |
||
200 | * Возвращает менеджер модулей |
||
201 | * |
||
202 | * @return ModuleManagerInterface |
||
203 | * |
||
204 | * @throws Exception\InvalidModuleManagerException |
||
205 | */ |
||
206 | public function getModuleManager() |
||
214 | |||
215 | /** |
||
216 | * Устанавливает менеджер модулей |
||
217 | * |
||
218 | * @param ModuleManagerInterface $moduleManager |
||
219 | * |
||
220 | * @return $this |
||
221 | */ |
||
222 | public function setModuleManager(ModuleManagerInterface $moduleManager) |
||
228 | } |
||
229 |