2013-02-23 4 views
1

zend framework이있는 사이트를 개발 중입니다. 클래스로드를 위해 autoload를 사용합니다. 컨트롤러에서는 모델에서 작동하지만 부트 스트랩 파일에서는 작동하지 않습니다. 왜?Zend autoload가 부트 스트랩에서 작동하지 않습니다.

bootstrap.php

protected function _initAutoload() 
    { 
     // Add autoloader empty namespace 
     $autoLoader = Zend_Loader_Autoloader::getInstance(); 
     $resourceLoader = new Zend_Loader_Autoloader_Resource(
       array('basePath' => APPLICATION_PATH, 'namespace' => '', 
         'resourceTypes' => array(
           'form' => array('path' => 'forms/', 'namespace' => 'Form_'), 
           'model' => array('path' => 'models/', 'namespace' => 'Model_'), 
           'plugin' => array('path' => 'plugin/', 'namespace' => 'Plugin_')))); 
     // viene restituto l'oggetto per essere utilizzato e memorizzato nel bootstrap 
     return $autoLoader; 
    } 
    /** 
    * inizializza l'autenticazione 
    */ 
    protected function _initAuth() 
    { 
     $this->bootstrap("db"); 
     $this->bootstrap("Autoload"); 
     $db = $this->getPluginResource('db')->getDbAdapter(); 
     $adp = new Zend_Auth_Adapter_DbTable($db); 
     $adp->setTableName(USERS_TABLE) 
     ->setIdentityColumn('username') 
     ->setCredentialColumn('password') 
     ->setCredentialTreatment('sha1(?)'); 
     $storage = new Model_Sessions(false, $db);//line 81 
     $auth = Zend_Auth::getInstance(); 
     $auth->setStorage($storage); 
     //$this->bootstrap('log');$log=$this->getResource('log'); 
     if ($auth->hasIdentity()) { 
      $identity = $auth->getIdentity(); 
      $user = $identity->user_id; 
     } else 
      $user = 1; 
     $user = new Model_user($user); 
    } 

출력 오차

치명적인 오류 : 클래스의 Model_Sessions '는 행에서 발견되지 /application/Bootstrap.php 81

Session.php에

<?php 
/** 
* @method get($k,$dv=FALSE) 
*/ 
class Model_Sessions implements Zend_Auth_Storage_Interface 
{ 

답변

3

자원 자동 공급기가 양호합니다.

이 아닌 것으로 알고 싶습니다. Model_sessions ("세션"에서 대문자/소문자가 아님)

클래스 Model_Sessions가 보조 노트로 파일 application/models/Sessions.php

에 저장되어 있는지 확인합니다, 당신은 당신의 자원 오토로더 네임 스페이스 접두사 plugins_와 플러그인을 찾고 있습니다. 다시 말하지만 여기에 대문자를 입력하고 싶습니다. Plugins_.

+0

이름을 변경했지만 부트 스트랩에서 작동하지 않습니다. – pagliaccio