Skip to content

Instantly share code, notes, and snippets.

@psaunders88
Created July 15, 2015 09:13
Show Gist options
  • Save psaunders88/2b653d8d6abc28fd59f7 to your computer and use it in GitHub Desktop.
Save psaunders88/2b653d8d6abc28fd59f7 to your computer and use it in GitHub Desktop.
Doctrine2 QB workaround for indexBy
// I want to modify the DQL include the 'index by'
// Reason: Often I find the indexBy function in the query builder frustrating
$qb = $qb->getQuery()->setDQL(
str_replace(
'WHERE',
'INDEX BY s.id WHERE', $qb->getDQL()
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment