getAllAliases(), true)) { throw new \LogicException("the alias 'person' does not exists in ".'query builder'); } if (!\in_array('acppart', $query->getAllAliases(), true)) { $query->join('person.accompanyingPeriodParticipations', 'acppart'); } if (!\in_array('acp', $query->getAllAliases(), true)) { $query->join('acppart.accompanyingPeriod', 'acp'); } } }