Hi, This was posted in Dec 2007. I have the same question. Is there anyway using fetchAll and setFetchMode to set the explicit class name that's returned in the array?
Or is this a design conflict? Here's basically the situation: class Articles extends Zend_Db_Table_Abstract { protected $_name = "articles"; protected $_rowClass = "Article"; public function fetchActive() { $db = Zend_Registry::get('db'); $db->setFetchMode(Zend_Db::FETCH_OBJ); $select = $db->select() ->from($this->_name) ->where('active = 1') ->order('creation_date DESC'); // want to return array of articles objects here instead of stdClass return $db->fetchAll($select); } } class Article extends Zend_Db_Table_Row_Abstract { } Is this the wrong way to approach models? Or is there a better way to obtain the fetchAll array of Articles as a return value from the fetchActive() method. Thanks very much! Renan Gonçalves wrote: > > Hello, > > How I can use fetchAll with fethMode = Object and using the class Article > (for example) ? > I can use fetchObject('Article') and will fetch on my class, but in > fetchAll > the default class is stdClass. > > The PDOStatement has the function: ( > http://www.php.net/manual/en/function.PDOStatement-setFetchMode.php) > bool *setFetchMode* ( int $PDO::FETCH_CLASS , string $classname , array > $ctorargs ) > > > Best Regards, > -- > Renan Gonçalves - Web Developer > Cell Phone: +55 (11) 8633-6018 > MSN: [EMAIL PROTECTED] > Web Site: renangoncalves.com > São Paulo - SP/Brazil > > -- View this message in context: http://www.nabble.com/Zend_Db-tp14140524p20373369.html Sent from the Zend Framework mailing list archive at Nabble.com.