@@ -167,12 +167,13 @@ private function getQueryBuilderWithNewAliases(QueryBuilder $queryBuilder, Query
167167 /** @var Join $joinPart */
168168 $ joinString = preg_replace ($ this ->buildReplacePatterns ($ aliases ), $ replacements , $ joinPart ->getJoin ());
169169 $ pos = strpos ($ joinString , '. ' );
170+ $ joinCondition = (string ) $ joinPart ->getCondition ();
170171 if (false === $ pos ) {
171- if (null !== $ joinPart -> getCondition () && null !== $ this ->resourceClassResolver && $ this -> resourceClassResolver ->isResourceClass ($ joinString )) {
172+ if ($ joinCondition && $ this ->resourceClassResolver ? ->isResourceClass($ joinString )) {
172173 $ newAlias = $ queryNameGenerator ->generateJoinAlias ($ joinPart ->getAlias ());
173174 $ aliases [] = "{$ joinPart ->getAlias ()}. " ;
174175 $ replacements [] = "$ newAlias. " ;
175- $ condition = preg_replace ($ this ->buildReplacePatterns ($ aliases ), $ replacements , $ joinPart -> getCondition () );
176+ $ condition = preg_replace ($ this ->buildReplacePatterns ($ aliases ), $ replacements , $ joinCondition );
176177 $ join = new Join ($ joinPart ->getJoinType (), $ joinPart ->getJoin (), $ newAlias , $ joinPart ->getConditionType (), $ condition );
177178 $ queryBuilderClone ->add ('join ' , [$ replacement => $ join ], true ); // @phpstan-ignore-line
178179 }
@@ -184,7 +185,7 @@ private function getQueryBuilderWithNewAliases(QueryBuilder $queryBuilder, Query
184185 $ newAlias = $ queryNameGenerator ->generateJoinAlias ($ association );
185186 $ aliases [] = "{$ joinPart ->getAlias ()}. " ;
186187 $ replacements [] = "$ newAlias. " ;
187- $ condition = preg_replace ($ this ->buildReplacePatterns ($ aliases ), $ replacements , $ joinPart -> getCondition () ?? '' );
188+ $ condition = preg_replace ($ this ->buildReplacePatterns ($ aliases ), $ replacements , $ joinCondition );
188189 QueryBuilderHelper::addJoinOnce ($ queryBuilderClone , $ queryNameGenerator , $ alias , $ association , $ joinPart ->getJoinType (), $ joinPart ->getConditionType (), $ condition , $ originAlias , $ newAlias );
189190 }
190191
0 commit comments