Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

fix ltrim with left parts match #352

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Event/Subscriber/DoctrineORMSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = substr($event->getField(), strlen($rootPart->getAlias.'.'));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$fieldName = substr($event->getField(), strlen($rootPart->getAlias.'.'));
$fieldName = substr($event->getField(), strlen($rootPart->getAlias().'.'));

$metadata = $queryBuilder->getEntityManager()->getClassMetadata($rootPart->getFrom());

if (isset($metadata->associationMappings[$fieldName]) && (!$metadata->associationMappings[$fieldName]['isOwningSide'] || $metadata->associationMappings[$fieldName]['type'] === ClassMetadataInfo::MANY_TO_MANY)) {
Expand Down