2011-08-04 5 views
0

나는 기본적인 zend 프레임 워크 프로젝트를 만들고 거기에 몇 개의 추가 모듈을 추가했다. 각 모듈에서 별도의 구성 파일을 작성하기로했습니다. 나는 그물에 일부 리소스를 따라, 그리고 제안으로, 나는 그것의이 오류를 제공,문제 설정 모듈 특정 설정 파일

class Custom_Bootstrap extends Zend_Application_Module_Bootstrap { 

    protected function _bootstrap() 
    { 
     $_conf = new Zend_Config_Ini(APPLICATION_PATH . "/modules/" . $this->getModuleName() . "/configs/application.ini", APPLICATION_ENV); 
     $this->_options = array_merge($this->_options, $_conf->toArray()); 
     parent::_bootstrap(); 
    } 
} 

그것조차 작동하지 않는 부트 스트랩 클래스 (안 애플리케이션 부트 스트랩 클래스)에 다음 코드를 배치했다. Zend_Application_Bootstrap_BootstrapAbstract의 소스 코드를 보면

Strict Standards: Declaration of Custom_Bootstrap::_bootstrap() should be compatible with that of Zend_Application_Bootstrap_BootstrapAbstract::_bootstrap() in xxx\application\modules\custom\Bootstrap.php on line 2 

답변

0

, _bootstrap의 선언은 다음과 같습니다

protected function _bootstrap($resource = null) 
    { 
     $_conf = new Zend_Config_Ini(APPLICATION_PATH . "/modules/" . $this->getModuleName() . "/configs/application.ini", APPLICATION_ENV); 
     $this->_options = array_merge($this->_options, $_conf->toArray()); 
     parent::_bootstrap($resource); 
    } 
+0

아니, 도움이되지 않았다. 같은 오류 – mrN

+0

이제 서브 클래스의 메소드가'protected function _bootstrap ($ resource = null)'으로 정의 되었는데도 여전히 오류가 발생합니까? 어떤 버전의 ZF를 사용하고 있습니까? 'Zend_Application_Module_Bootstrap'에서'_bootstrap'이 선언 된 모습을 볼 수 있습니까? – ChrisA

+0

최신 1.11.9 – mrN

2

:

protected function _bootstrap($resource = null) 
    { 
     ... 
    } 

그래서 그냥 같이 당신의 재정을 변경해야 부트 스트랩 방법을 무시하지 말고 모듈 구성 리소스로 만드십시오.

class Custom_Bootstrap extends Zend_Application_Module_Bootstrap 
{ 
    protected function _initConfig() 
    { 
     $config = new Zend_Config_Ini(APPLICATION_PATH . "/modules/" . $this->getModuleName() . "/configs/application.ini", APPLICATION_ENV); 
     $this->_options = array_merge($this->_options, $config->toArray()); 

     return $this->_options; 
    } 
} 

모듈이 부트 스트랩 될 때 자동으로 실행됩니다.

+0

을 사용하고 있습니다. 그러나 새 설정을 새 설정과 병합해야합니다. – mrN

+0

동일한 방법으로 계속 수행 할 수 있습니다 - 배열 병합을 코드 예제에 추가했습니다. –

+0

당신은 $ this -> _options에서 합병하고 $ config를 반환하고 있습니다. 그게 틀림 없습니까? 먼저 시도해보십시오. – mrN