我有两张桌子:
// User.php
class Model_Table_Users extends Zend_Db_Table_Abstract
{
protected $_name = 'users';
protected $_primary = 'id';
protected $_dependentTables = array('UserGroups');
}
// UserGroups.php
class Model_Table_UserGroups extends Zend_Db_Table_Abstract
{
protected $_name = 'userGroups';
protected $_referenceMap = array(
'User' => array(
'columns' => array('idUsers'),
'refTableClass' => 'users',
'refColumns' => array('id')
),
'Group' => array(
'columns' => array('idGroups'),
'refTableClass' => 'groups',
'refColumns' => array('id')
)
);
}
自从Zend 1.10更新到1.12。*
当我想要删除用户时出现以下错误,对我而言,它看起来不是在UserGroups.php文件的当前文件夹中搜索。
Warning: include_once(UserGroups.php): failed to open stream: No such file or directory in /usr/share/php/Zend/Loader.php on line 134
Call Stack:
0.0000 640960 1. {main}() /var/data/websites/test.bazinga.at/public/index.php:0
0.0648 5056416 2. Zend_Controller_Front->dispatch() /var/data/websites/test.bazinga.at/public/index.php:166
0.0664 5207632 3. Zend_Controller_Dispatcher_Standard->dispatch() /usr/share/php/Zend/Controller/Front.php:954
0.0697 5411880 4. Zend_Controller_Action->dispatch() /usr/share/php/Zend/Controller/Dispatcher/Standard.php:308
0.0698 5426312 5. Users_UserController->deleteAction() /usr/share/php/Zend/Controller/Action.php:516
0.0704 5453504 6. Model_Users->deleteUser() */modules/users/controllers/UserController.php:417
0.0706 5500232 7. Zend_Db_Table_Abstract->delete() */modules/users/models/Users.php:180
0.0735 5724672 8. Zend_Db_Table_Abstract::getTableFromString() /usr/share/php/Zend/Db/Table/Abstract.php:1193
0.0736 5724672 9. Zend_Loader::loadClass() /usr/share/php/Zend/Db/Table/Abstract.php:1594
0.0736 5725056 10. Zend_Loader::loadFile() /usr/share/php/Zend/Loader.php:82
Warning: include_once(): Failed opening 'UserGroups.php' for inclusion (include_path='/var/data/websites/test.bazinga.at/library:.:/usr/share/php:/usr/share/pear') in /usr/share/php/Zend/Loader.php on line 134
Call Stack:
0.0000 640960 1. {main}() /var/data/websites/test.bazinga.at/public/index.php:0
0.0648 5056416 2. Zend_Controller_Front->dispatch() /var/data/websites/test.bazinga.at/public/index.php:166
0.0664 5207632 3. Zend_Controller_Dispatcher_Standard->dispatch() /usr/share/php/Zend/Controller/Front.php:954
0.0697 5411880 4. Zend_Controller_Action->dispatch() /usr/share/php/Zend/Controller/Dispatcher/Standard.php:308
0.0698 5426312 5. Users_UserController->deleteAction() /usr/share/php/Zend/Controller/Action.php:516
0.0704 5453504 6. Model_Users->deleteUser() */modules/users/controllers/UserController.php:417
0.0706 5500232 7. Zend_Db_Table_Abstract->delete() */modules/users/models/Users.php:180
0.0735 5724672 8. Zend_Db_Table_Abstract::getTableFromString() /usr/share/php/Zend/Db/Table/Abstract.php:1193
0.0736 5724672 9. Zend_Loader::loadClass() /usr/share/php/Zend/Db/Table/Abstract.php:1594
0.0736 5725056 10. Zend_Loader::loadFile() /usr/share/php/Zend/Loader.php:82
我也检查了Zend更改日志,但没有发现任何相关信息。
答案 0 :(得分:1)
您是否尝试过使用类的全名?
// User.php
class Model_Table_Users extends Zend_Db_Table_Abstract
{
protected $_name = 'users';
protected $_primary = 'id';
protected $_dependentTables = array('Model_Table_UserGroups');
}
// UserGroups.php
class Model_Table_UserGroups extends Zend_Db_Table_Abstract
{
protected $_name = 'userGroups';
protected $_referenceMap = array(
'User' => array(
'columns' => array('idUsers'),
'refTableClass' => 'Model_Table_Users',
'refColumns' => array('id')
),
'Group' => array(
'columns' => array('idGroups'),
'refTableClass' => 'Model_Table_Groups',
'refColumns' => array('id')
)
);
}