Zend Framework通过数据映射器模块删除。

时间:2009-07-21 22:43:24

标签: zend-framework

我仍然遇到定义表关系的问题,并且刚刚根据建议改变了用户和评论类之间的关系,但是当我去测试时我遇到了新的错误。

C:\wamp\www\megashare\application\models\UsersMapper.php
public function deleteUser($id, Default_Model_Users $users){

        $usersTable = new Default_Model_DbTable_Users();        
        $usersRowset = $usersTable->find( $id );    
        $userToDelete = $usersRowset->current();            
        $userToDelete->delete();

    }

生成以下错误:

Zend Error Type: EXCEPTION_OTHER
REQUEST_URI: /megashare/public/users/delete/userId/14
Stack trace: 
#0 C:\wamp\www\megashare\application\models\UsersMapper.php(104): Zend_Db_Table_Row_Abstract->delete()
#1 C:\wamp\www\megashare\application\models\Users.php(761): Default_Model_UsersMapper->deleteUser(14, Object(Default_Model_Users))
#2 C:\wamp\www\megashare\application\controllers\UsersController.php(112): Default_Model_Users->deleteUser(14)
#3 C:\wamp\www\megashare\library\Zend\Controller\Action.php(512): UsersController->deleteAction()
#4 C:\wamp\www\megashare\library\Zend\Controller\Dispatcher\Standard.php(288): Zend_Controller_Action->dispatch('deleteAction')
#5 C:\wamp\www\megashare\library\Zend\Controller\Front.php(936): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#6 C:\wamp\www\megashare\library\Zend\Application\Bootstrap\Bootstrap.php(77): Zend_Controller_Front->dispatch()
#7 C:\wamp\www\megashare\library\Zend\Application.php(303): Zend_Application_Bootstrap_Bootstrap->run()
#8 C:\wamp\www\megashare\public\index.php(31): Zend_Application->run()
#9 {main}

1 个答案:

答案 0 :(得分:0)

我不知道为什么,但这个错误现在已经停止了。此示例中的代码没有任何问题。还有其他与此问题无关的问题。因此请考虑回答这个问题。我认为底层的模型类定义必定是不可行的。