When I am callin fetchAll() on my DbTable I get results in proper DbRow classes defined in DbTable.
But when I create custom query like this I get results in array. Is there any parameter that can force receiving this data ind DbRows or I should create rows by myself and populate them with those arrays?
$query = $this->_dbTable->getDefaultAdapter()->select()
->from('doctor.doctor')
->joinInner('facility.doctorfacility', 'facility.doctorfacility.doctor_id = doctor.doctor.id')
->joinInner('facility.facility', 'facility.doctorfacility.facility_id = facility.facility.id')
->where(implode(' AND ', $conds));
return $this->_dbTable->getDefaultAdapter()->fetchAll($query);
You are getting an array because you are calling
Zend_Db_Adapter_Abstract::fetchAll()which according to the docblock in the code returns an array:-When you do this you are calling
Zend_Db_Table_Abstract::fetchAll()which according to the docblock in the code returns aZend_Db_Table_Rowset:-No there isn’t but if you call the correct method on the correct object you will get your rowsets returned.
To do this change this line:-
To:-
An this line:-
To:-
That should get you what you need. It is always worthwhile looking at the code if you are stuck in ZF, it is by far the best documentation available.