简体   繁体   English

使用Zend_Db_Table_Abstract :: createRow()时遇到问题

[英]having problems using Zend_Db_Table_Abstract::createRow()

I have built a model that extends Zend_Db_Table_Abstract and I can't figure out why I can't use createRow(); 我已经建立了一个扩展Zend_Db_Table_Abstract的模型,我不知道为什么不能使用createRow();。 here is my code: 这是我的代码:

class Model_User extends Zend_Db_Table_Abstract
{
   public function createUser()
   {
       $row = $this->createRow();
       $row->name = 'test';
       $row->save();
   }
}

and in a controller I use: 在控制器中,我使用:

$userModel = new Model_User();
$userModel->createUser();

which when run displays an error 运行时显示错误

An error occurred 发生错误

Application error 应用程序错误

here is my setup in application.ini 这是我在application.ini中的设置

resources.db.adapter = "pdo_mysql"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = "pass"
resources.db.params.dbname = "app_db"
resources.db.isDefaultTableAdapter = true

I am sure that my user/pass/dbname is correct. 我确定我的用户名/密码/ dbname是正确的。

I would appreciate it if you point me in the right direction. 如果您指出正确的方向,我将不胜感激。

Vika's hint is correct though you should add all the following to the development section of your app.ini file Vika的提示是正确的,尽管您应该将以下所有内容添加到app.ini文件的开发部分中

phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

Then you (and we) will get much more information about what's wrong 然后,您(和我们)将获得更多有关出问题的信息

Make sure that your ErrorController class has code to show you the errors. 确保您的ErrorController类具有向您显示错误的代码。 If you remove the code which displays the Exception then you'll never know what is wrong. 如果您删除显示Exception的代码,那么您将永远不会知道出了什么问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM