You can instantiate the Row class directly with new
.
But the Row object needs to know which columns are valid for this row of data.
There is no magic to match the row class name with the corresponding table class name. Therefore, the row itself does not know which table it belongs to. Therefore, he cannot guess how to write SQL to perform insert or update operations; it gets this metadata from the corresponding Zend_Db_Table object. You must specify the row in which the table should be used.
If you create a row object with new
, you must pass the configuration array to the constructor, including the name of the table class, or an instance of the object of this table class.
$userRow = new App_Row_User( array('table' => 'App_Table_User') );
or
$userTable = new App_Table_User(); $userRow = new App_Row_User( array('table' => $userTable) );
Without a valid table name or class name, instantiating a Row object with new
will throw an exception.
Similarly, save()
uses a table object by calling the insert()
or update()
methods. Without a valid table object, the Row save()
method throws an exception.
source share