Update:
Now I know I've missed something. In my debugging process, here's what I did. Open: Zend/DB/Table/Rowset/Abstract.php Goto Line: 71 Replace Value of: protected $_rowClass = 'Zend_Db_Table_Row' With: protected $_rowClass = 'Account' Have access to Account->helloWorld(); I'll keep digging, I seem to be missing a step along the way. -Ryan PS: Undo changes, save. ;) _____ From: Ryan Brooks [mailto:[EMAIL PROTECTED] Sent: March 19, 2007 1:32 PM To: fw-general@lists.zend.com Subject: [fw-general] $db->setRowClass & $db->setRowsetClass Hi guys, this email will be a little long to explain my confusion, please bear with me. I am trying to create some domain logic in my result objects so I have access to methods on rowsets and rows. It kinda works, but kinda doesn't. Unfortunately I think I am either missing something completely, or what I'm trying to do just isn't possible. I am using the latest nightly build. This all came from wanting to change this: $article = $db->query($sql)->fetchObject(__CLASS__); Here's my error: Fatal error: Uncaught exception 'Zend_Db_Table_Row_Exception' with message 'Unrecognized method 'helloWorld()'' in D:\_php\www\includes\Zend\Db\Table\Row\Abstract.php Well, that's obvious - I'm trying to access a non-existent method. However, here's some code. I hope that you'll be able to understand at a glance what I'm trying to do. I have stripped out most of my un-needed code. I can verify that the database has connected, and the view object does exist. class AccountsController extends BootstrapController { public function indexAction() { $accounts = new Accounts(); $this->view->accounts = $accounts->fetchAll(); Zend_Debug::dump($this->view->accounts); // debug foreach($this->view->accounts as $account) { echo $account->helloWorld(); // This is the cause of our problem } } } class Accounts extends Zend_Db_Table { public function _setup($config = array()) { $this->_name = 'accounts'; $this->setRowClass('Account'); // this seems to be ignored $this->setRowsetClass('AccountsRowset'); parent::_setup($config); } } class AccountsRowset extends Zend_Db_Table_Rowset { public function _setup($config = array()) { $this->_name = 'accounts'; $this->setRowClass('Account'); // this seems to be ignored parent::_setup($config); } } class Account extends Zend_Db_Table_Row { public function _setup($config = array()) { $this->_name = 'accounts'; parent::_setup($config); } public function helloWorld() { return 'hello ' . $this->name; } } Now. When I look at the dump(), I can see the data. The row class and rowset class is being set. However, it is still calling Zend_Db_Table_Row. To aid in debugging, here is my dump. object(AccountsRowset)#20 (8) { ["_data:protected"] => array(2) { [0] => array(7) { ["id"] => string(1) "1" ["date_entered"] => string(19) "2007-03-17 21:24:38" ["date_modified"] => NULL ["created_by"] => string(1) "1" ["assigned_user_id"] => NULL ["name"] => string(1) "d" ["deleted"] => NULL } [1] => array(7) { ["id"] => string(1) "2" ["date_entered"] => string(19) "2007-03-19 11:45:17" ["date_modified"] => NULL ["created_by"] => string(1) "1" ["assigned_user_id"] => NULL ["name"] => string(4) "dddd" ["deleted"] => NULL } } ["_table:protected"] => object(Accounts)#19 (8) { ["_db:protected"] => object(Zend_Db_Adapter_Pdo_Mysql)#12 (5) { ["_pdoType:protected"] => string(5) "mysql" ["_config:protected"] => array(6) { ["dbtype"] => string(9) "pdo_mysql" ["host"] => string(9) "localhost" ["username"] => string(4) "root" ["password"] => string(0) "" ["dbname"] => string(3) "crm" ["debugEnabled"] => string(4) "true" } ["_fetchMode:protected"] => int(2) ["_profiler:protected"] => object(Zend_Db_Profiler)#14 (4) { ["_queryProfiles:protected"] => array(0) { } ["_enabled:protected"] => bool(false) ["_filterElapsedSecs:protected"] => NULL ["_filterTypes:protected"] => NULL } ["_connection:protected"] => object(PDO)#17 (0) { } } ["_name:protected"] => string(8) "Accounts" ["_cols:protected"] => array(7) { [0] => string(2) "id" [1] => string(12) "date_entered" [2] => string(13) "date_modified" [3] => string(10) "created_by" [4] => string(16) "assigned_user_id" [5] => string(4) "name" [6] => string(7) "deleted" } ["_primary:protected"] => string(2) "id" ["_rowClass:protected"] => string(7) "Account" ["_rowsetClass:protected"] => string(14) "AccountsRowset" ["_referenceMap:protected"] => array(0) { } ["_dependentTables:protected"] => array(0) { } } ["_connected:protected"] => bool(true) ["_tableClass:protected"] => string(8) "Accounts" ["_rowClass:protected"] => string(17) "Zend_Db_Table_Row" ["_pointer:protected"] => int(0) ["_count:protected"] => int(2) ["_rows:protected"] => array(0) { } } I'm hoping someone can help me out. I'm kinda at a loss. -Ryan