2013-08-24 2 views
1

내 모델에 Propel ORM을 사용합니다. & 매핑. 내 모델은/models 아래에 있습니다.새 네임 스페이스의 모델에 액세스 할 수 없습니다.

// Ensure library/ is on include_path 
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'), 
    realpath(APPLICATION_PATH . '/models'),//propel 
    get_include_path(), 
))); 

내가 잘 작동 내 모듈에 쿼리를 사용할 수 있습니다
나는 확실히 그가 내 모델을 발견 있는지 확인하기 위해 내 index.php 파일에 한 줄을 추가했습니다. 하지만 Acl Helper에서이 모델을 사용할 때 모델을 찾을 수 없습니다.

Zend Framework 프로젝트에서 "GentseFeesten"이라는 네임 스페이스를 만들었습니다.
내 Bootstrap.php이 추가되었습니다 :

  • Controller
    • Helper
    • Plugin

을 그리고 도우미에서 나는 "Acl.php"가 :

protected function _initAutoload() 
{ 
    $moduleLoader = new Zend_Application_Module_Autoloader(array(
     'namespace' => '', 
     'basePath' => APPLICATION_PATH)); 
    $autoloader = Zend_Loader_Autoloader::getInstance(); 
    $autoloader->registerNamespace('GentseFeesten_'); 
    return $moduleLoader; 
} 

을 내 GentseFeesten 라이브러리에서 나는 있습니다. 함수가 있습니다. setRoles() :

private function setRoles() { 

    // Database query 
    $roles = RoleQuery::create() 
     ->orderById() 
     ->find(); 

    foreach ($roles as $role) { 
     if($parentrole == 0) 
     { 
      $this->local_acl->addRole(new Zend_Acl_Role($role->getRole())); 
     } 
     else{ 
      $this->local_acl->addRole(new Zend_Acl_Role($role->getRole()), $parentrole); 
     } 
     $parentrole = $role->getRole(); 
    } 
} 

그러나 RoleQuery를 찾을 수 없습니다. 이 오류는 그가 플러그인에 내 모델을 찾을 수없는 이유

new GentseFeesten_Controller_Helper_Acl($this->getResource('frontController')); 
    $frontController = Zend_Controller_Front::getInstance(); 
    $frontController->registerPlugin(new GentseFeesten_Controller_Plugin_Acl()); 

사람이 알고 있나요

:

Fatal error: Class 'RoleQuery' not found in /Applications/MAMP/htdocs/GentseFeesten/library/GentseFeesten/Controller/Helper/Acl.php on line 35

I는 다음과 같이 부트 스트랩에 내 ACL이 플러그인을 포함 시켰습니다?

답변

0

propel 플러그인을 먼저 초기화 한 다음 acl 플러그인을 초기화해야했습니다. 방금 두 기능의 위치를 ​​변경하고 작동했습니다!