Zend \ Di에 대한 도움말이 필요합니다.Zend Di 구성 방법
Zend \ ServiceManager를 사용하여 응용 프로그램에 공장을 작성하는 작업에 지치기 때문에 Zend \ Di의 MVC 환경에서 구성 작업이 어떻게 작동하는지 알고 싶습니다.
내가 상단 키di
에서
module.config.php
의 일부 구성,
this post of @Ocramius 참조
:
<?php
return array(
'di' => array(
'allowed_controllers' => array(
// this config is required, otherwise the MVC won't even attempt to ask Di for the controller!
'Application\Controller\GreetingController',
),
'instance' => array(
'preference' => array(
// these allow injecting correct EventManager and ServiceManager
// (taken from the main ServiceManager) into the controller,
// because Di doesn't know how to retrieve abstract types. These
// dependencies are inherited from Zend\Mvc\Controller\AbstractController
'Zend\EventManager\EventManagerInterface' => 'EventManager',
'Zend\ServiceManager\ServiceLocatorInterface' => 'ServiceManager',
),
),
),
// remaining config
);
누구나이 구성 또는 여기에 더 자세한 예제의 문서에 URL을 게시 할 수 있습니까?
같은 것은 아니며 많은 초기화 프로그램을 가질 수 없습니다. 각각은 서비스 관리자에게 요청할 때마다 실행됩니다. –
컨트롤러가 많고 선택할 수있는 서비스가 많은 경우 Configuration 또는 Annotation을 사용하는 컨트롤러가 다음 링크에서 선택해야합니다. https : //github.com/ralphschindler/Zend_DI-Examples – Pradeep
감사합니다. 나는 이것을 module.config.php의 "di"w 키에 사용하려고 시도 할 것이다. 슬픈 일로 잘 문서화 된 방법이 아닙니다. 응답 또는 응답을 다시 변경하여 올바른 것으로 선택하십시오. –