Reis mit Eis Reis mit Eis - 1 year ago 77
PHP Question

why I cant use getCollection() or getData() after using join?

$datas = $collection->getSelect()->join(array('B' => $table), 'main_table.entity_id = B.parent_id', array());

when I try to use:




I am getting this error:

Fatal error: Uncaught exception 'Zend_Db_Select_Exception' with message 'Unrecognized method 'getData()'' in

and how can I use addFieldToFilter() after using a "join"?

Answer Source

Because you're assigning the result of a Zend DB statement to your $datas variable, which would make it an instance of Zend_Db_Select rather than a collection.

You should just make changes by reference rather than assigning it to your variable.


Then continue to use $collection:

foreach ($collection as $entity) {