I have the following zendframework model classes
class Application_Model_DbTable_Mobile extends Zend_Db_Table_Abstract {
protected $_name = 'mobile';
protected $_rowClass = 'Application_Model_Mobile';
}
Object Class
class Application_Model_Mobile extends Zend_Db_Table_Row_Abstract {
}
But when I try to save directly from o Application Model_Mobile it returns an error
$m = new Application_Model_Mobile();
$m->name = 'Mobile Test';
$m->save();
Application error
Exception information:
Message: Specified column "chave" is not in the row
How could I tell Application_Model_Celular has mobile table?
Try:
class Application_Model_Mobile extends Zend_Db_Table_Row_Abstract {
protected $_tableClass = 'Application_Model_DbTable_Mobile';
}
Normally you wouldn't use Zend_Db this way (although you may have a perfectly good reason to). The standard way to do this would be to not define the Application_Model_Mobile class and just write the code as:
$table = new Application_Model_DbTable_Mobile();
$m = $table->createRow();
$m->name = 'Mobile Test';
$m->save();