Skip to content

Commit

Permalink
[PATCH] Erroneously fails to search when table names match
Browse files Browse the repository at this point in the history
  • Loading branch information
ksn135 authored and javiereguiluz committed Jul 9, 2024
1 parent 9ec576c commit cf22ec8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Orm/EntityRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,13 @@ private function getSearchablePropertiesConfig(QueryBuilder $queryBuilder, Searc
$associatedEntityAlias = $associatedPropertyName = '';
for ($i = 0; $i < $numAssociatedProperties - 1; ++$i) {
$associatedEntityName = $associatedProperties[$i];
$associatedEntityAlias = Escaper::escapeDqlAlias($associatedEntityName);
$associatedEntityAlias = Escaper::escapeDqlAlias($associatedEntityName).($i ?: '');

Check failure on line 265 in src/Orm/EntityRepository.php

View workflow job for this annotation

GitHub Actions / phpstan

Short ternary operator is not allowed. Use null coalesce operator if applicable or consider using long ternary.
$associatedPropertyName = $associatedProperties[$i + 1];

if (!\in_array($associatedEntityName, $entitiesAlreadyJoined, true)) {
if (!\in_array($associatedEntityAlias, $entitiesAlreadyJoined, true)) {
$parentEntityName = 0 === $i ? 'entity' : $associatedProperties[$i - 1];
$queryBuilder->leftJoin(Escaper::escapeDqlAlias($parentEntityName).'.'.$associatedEntityName, $associatedEntityAlias);
$entitiesAlreadyJoined[] = $associatedEntityName;
$entitiesAlreadyJoined[] = $associatedEntityAlias;
}

if ($i < $numAssociatedProperties - 2) {
Expand Down

0 comments on commit cf22ec8

Please sign in to comment.