Skip to content

Instantly share code, notes, and snippets.

@michaelesmith
Created January 31, 2011 16:04
Show Gist options
  • Save michaelesmith/804245 to your computer and use it in GitHub Desktop.
Save michaelesmith/804245 to your computer and use it in GitHub Desktop.
Problem fetching the same Doctrine object with two different queries
$lead_all = LeadTable::getInstance()->createQuery('l')->leftJoin('l.ToDoItems tdi')->where('l.id = ?', 7)->fetchOne();
echo count($lead_all->getToDoItems()); //prints 4
$NOT_LEAD_ALL = LeadTable::getInstance()->createQuery('l')->leftJoin('l.ToDoItems tdi')->where('l.id = ?', 7)->addWhere('tdi.close_date IS NOT NULL')->fetchOne();
echo count($lead_all->getToDoItems()); //prints 1 instead of 4 like above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment