简体   繁体   中英

Can't use createRow from Zend_Db_Table_Row

I have a Model_User class which is extending Zend_Db_Table_Row but when I try to insert a row like this:

    $user = new Model_User();

    $data = array(
        'user_login' => $form->getValue('username'),
        'user_password' => $this->saltPassword($form->getValue('password')),
        'user_email' => $form->getValue('email')
    );

    $newUser = $user->createRow($data);

I get an error: An error occurred, Application error (Actually does anyone know how to have more clear error messages? These are very vague)

My model class is like described in the solution of this post . (So I also have a Model_User_Table class which is extending Zend_Db_Table_Abstract )

Any ideas?

Method createRow is defined for Zend_Db_Table_Abstract , not for Zend_Db_Table_Row_Abstract . Just change your code to

$user = new Model_User_Table();
$newUser = $user->createRow($data);

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