zf2에서 코드를 추적하면 응용 프로그램 서비스가 등록되는 위치를 찾을 수 없습니다. 여기 application.phpzf2의 loadModules.post는 기능입니까?
public static function init($configuration = array())
{
$smConfig = isset($configuration['service_manager']) ? $configuration['service_manager'] : array();
$serviceManager = new ServiceManager(new Service\ServiceManagerConfig($smConfig));
$serviceManager->setService('ApplicationConfig', $configuration);
$serviceManager->get('ModuleManager')->loadModules();
return $serviceManager->get('Application')->bootstrap();
}
코드 "$ serviceManager->의 get ('응용 프로그램')"의 코드 응용 프로그램 서비스를받을 것입니다. 그러나 응용 프로그램 서비스는 어디에 등록 되었습니까?
그런 다음 응용 프로그램 서비스가 ZF2/library의 "$ this-> getEventManager() -> trigger (ModuleEvent :: EVENT_LOAD_MODULES_POST, $ this, $ this-> getEvent())"코드 줄과 관련되어 있음을 알게되었습니다. /Zend/MoudleManager/MoudleManager.php
public function loadModules()
{
if (true === $this->modulesAreLoaded) {
return $this;
}
$this->getEventManager()->trigger(ModuleEvent::EVENT_LOAD_MODULES, $this, $this->getEvent());
/**
* Having a dedicated .post event abstracts the complexity of priorities from the user.
* Users can attach to the .post event and be sure that important
* things like config merging are complete without having to worry if
* they set a low enough priority.
*/
$this->getEventManager()->trigger(ModuleEvent::EVENT_LOAD_MODULES_POST, $this, $this->getEvent());
return $this;
}
또 다른 질문은 "ModuleEvent :: EVENT_LOAD_MODULES_POST, 즉 트리거 기능의 loadModules.post.The 첫 PARAM 함수 이름이라는 것이다. 그래서이 loadModules.post입니다 어떤 기능을 정의 했습니까?
미리 감사드립니다.
Matthew, 고맙습니다. 그리고 감사합니다. – Leo