Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save maximecolin/75cbe517de5ab62a0bcac8bf457c92b7 to your computer and use it in GitHub Desktop.
Save maximecolin/75cbe517de5ab62a0bcac8bf457c92b7 to your computer and use it in GitHub Desktop.
Doctrine hasJoin
/**
* Has join
*
* @param string $root
* @param string $relation
*
* @return bool
*/
private function hasJoin($root, $relation)
{
$parts = $this->getDQLPart('join');
if (isset($parts[$root])) {
foreach ($parts[$root] as $join) {
if ($join instanceof Join && $join->getJoin() === sprintf('%s.%s', $root, $relation)) {
return true;
}
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment