I'm working with custom models in Magento, I need to populate a grid and in order to do that I need to join 2 tables, I used collections and the SQL seems to be right as a vardump will print the expected query, but I don't know how to access to the fields as when I iterate the collection nothing prints out.
Here is my code:
$collection = Mage::getModel('myModule/permission')->getCollection()
->addFieldToSelect('unique_role_identifier')
->addFieldToFilter('user_name',array('eq'=>'[email protected]'))
->getSelect()
->join('theroles',
'main_table.unique_role_identifier = theroles.unique_role_identifier',
array('role'=>'role_description'));
var_dump((string) $collection); // prints the correct query
foreach($collection as $c){
echo '<h3>'.$c->getRoleDescription().'</h3>'; //prints nothing
}
Any help would be greatly appreciated.