简体   繁体   中英

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(); 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

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.

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

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. If you remove the code which displays the Exception then you'll never know what is wrong.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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