2012-06-16 5 views
0

내 응용 프로그램의 구조는 다음과 같다 :자동로드 모델은, 젠드 프레임 워크 내부 모듈을 형성

  • 응용 프로그램
    • 모듈
      • 기본
      • 학생
        • 컨트롤러
        • 형태
          • studentParent.php
        • 모델
        • 전망
        • Boostrap.php

내가 가지고는 studentParent.php 내부 학생 모듈의 폴더를 형성 . 내가 학생 모듈의 컨트롤러 내에서이 폼 클래스를 호출 할 때마다

class Student_Form_studentParent extends Zend_Dojo_Form{ 
} 

, 나는 내가 학생 모듈 내부 Bootstrap.php을 배치 한 클래스를 찾을 수 없습니다 오류 를 얻을.

class Student_Bootstrap extends Zend_Application_Module_Bootstrap 
{ 

} 

가 여기 내 application.ini 파일 구성의

resources.frontController.params.displayExceptions = 0 
resource.modules="" 
resources.view = "" 
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" 
resources.layout.layout = "main_template" 

내 Bootstrap.php 파일 :

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap 
{ 
    protected function _initDefaultModuleAutoloader() 
    { 
     $moduleLoader = new Zend_Application_Module_Autoloader(
    array(
     "namespace" => '', 
     "basePath" => APPLICATION_PATH.'/modules/default' 
     ) 
    ); 

      Zend_Controller_Action_HelperBroker::addPrefix('App_Action_Helper'); 

      return $moduleLoader; 
    } 
} 

답변

3
resource.modules="" 

가 있어야한다 :

resources.modules="" 

(즉, 자원 복수).

대문자를 사용하여 클래스 이름을 시작하는 것이 좋습니다. 따라서 Student_Form_studentParent 대신 Student_Form_StudentParent (파일 이름은 StudentParent.php이어야합니다)을 시작하는 것이 좋습니다. 개인적인 선호 내가 생각하기는하지만, 프레임 워크가 한 방향으로 만 수행하고 앱이 다른 방식으로 수행한다면 클래스 네이밍은 일관성이 없습니다.

0

는 또한

$moduleLoader = new Zend_Application_Module_Autoloader(
array(
    "namespace" => '', 
    "basePath" => APPLICATION_PATH.'/modules/default' 
    ) 
); 

basePath 모듈을 포함하는 디렉토리를 가리켜 야 아니라, 내 예에서와 같이, 특정 모듈 해줄 것이다.

+0

실제로 모듈 자동 공급기는 모듈 디렉토리를 가리켜 야합니다. –