diff --git a/Event/Subscriber/DoctrineORMSubscriber.php b/Event/Subscriber/DoctrineORMSubscriber.php index b8cc6e8..62d8d24 100644 --- a/Event/Subscriber/DoctrineORMSubscriber.php +++ b/Event/Subscriber/DoctrineORMSubscriber.php @@ -78,7 +78,7 @@ public function filterEntity(GetFilterConditionEvent $event) if ($dqlFrom = $event->getQueryBuilder()->getDQLPart('from')) { $rootPart = reset($dqlFrom); - $fieldName = ltrim($event->getField(), $rootPart->getAlias() . '.'); + $fieldName = preg_replace('/^'.$rootPart->getAlias().'\./', '', $event->getField()); $metadata = $queryBuilder->getEntityManager()->getClassMetadata($rootPart->getFrom()); if (isset($metadata->associationMappings[$fieldName]) && (!$metadata->associationMappings[$fieldName]['isOwningSide'] || $metadata->associationMappings[$fieldName]['type'] === ClassMetadataInfo::MANY_TO_MANY)) {