2012-09-19 61 views
1

試圖與棚戶蒙戈,和Zend玩(我是新來的兩個),但我不斷收到:類「Shanty_Mongo_Document」未找到

"Fatal error: Class 'Shanty_Mongo_Document' not found 
    in /var/www/dbtz/application/models/User.php on line 4" 

首先,我的控制器的indexAction:

public function indexAction() 
{ 
    $this->view->pageTitle = "Add User"; 

    $form = new Application_Form_UserAdd(); 

    if ($this->_request->isPost()) { 
     $formData = $this->_request->getPost(); 
     if ($form->isValid($formData)) { 
      $user = new Application_Model_User(); 
      $user->username = $formData['username']; 

      $user->save(); 
      exit; 
     } else { 
      $form->populate($formData); 
     } 
    }   

    $this->view->form = $form; 
} 

二,型號:

class Application_Model_User extends Shanty_Mongo_Document 
{ 
    protected static $_db = 'dbtz'; 
    protected static $_collection = 'user'; 

    public static $_requirements = array(
     'username' => 'Required', 
     'password' => 'Required', 
    ); 
} 

我有符號鏈接到庫文件夾庫/棚戶區目錄中。這就是我包含Zend庫的方式,並且它工作正常。

樹庫文件夾中:

/var/www/dbtz/library# tree -l 
. 
├── Shanty -> /var/www/libs/Shanty-Mongo/library/Shanty/ 
│   ├── Mongo 
│   │   ├── Collection.php 
│   │   ├── Connection 
│   │   │   ├── Group.php 
│   │   │   └── Stack.php 
│   │   ├── Connection.php 
│   │   ├── Document.php 
│   │   ├── DocumentSet.php 
│   │   ├── Exception.php 
│   │   ├── Iterator 
│   │   │   ├── Cursor.php 
│   │   │   └── Default.php 
│   │   └── Validate 
│   │    ├── Array.php 
│   │    ├── Class.php 
│   │    └── StubTrue.php 
│   ├── Mongo.php 
│   └── Paginator 
│    └── Adapter 
│     └── Mongo.php 
└── Zend -> /usr/share/php/libzend-framework-php/Zend/ 
... 
+0

不太熟悉與Zend必要的,但你可以暫時掛接到自動裝卸系統,看看它是尋找類文件? – halfer

+0

確保已將庫文件放在正確的位置 –

+0

據我所知,它們是 – devilsansclue

回答

2

想通了。到

autoloaderNamespaces[] = "Shanty_" 

添加到我的application.ini