Skip to content

Instantly share code, notes, and snippets.

@delbono
Created August 31, 2010 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save delbono/558843 to your computer and use it in GitHub Desktop.
Save delbono/558843 to your computer and use it in GitHub Desktop.
<?php
class OrdinativiMenuItemDayTable extends Doctrine_Table
{
public static function getInstance()
{
return Doctrine_Core::getTable('OrdinativiMenuItemDay');
}
public function getWeekMenus( $menu_id )
{
$foods = Doctrine::getTable('OrdinativiMenuItemDay')
->createQuery('a')
->leftJoin('a.MenuItemDays m')
->where('a.menu_id = ? ', $menu_id )
->execute();
foreach($foods as $food){
$food->MenuItemDays;
$item = $food->getMenuItemDays();
var_dump($item->getName()); // Fatal error: Call to undefined method Doctrine_Collection::getName() in
}
}
}
SELECT o.id AS o__id, o.menu_id AS o__menu_id, o.item_id AS o__item_id, o.day AS o__day, o.week AS o__week, o.enabled AS o__enabled, o.created_at AS o__created_at, o.updated_at AS o__updated_at, o2.id AS o2__id, o2.menu_id AS o2__menu_id, o2.name AS o2__name, o2.type AS o2__type, o2.state AS o2__state, o2.enabled AS o2__enabled, o2.created_at AS o2__created_at, o2.updated_at AS o2__updated_at FROM ordinativi_menu_item_day o
LEFT JOIN ordinativi_menu_item o2 ON o.item_id = o2.id
WHERE (o.menu_id = 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment