From 902167c2ed41a2723ca7d8e47be0ec318bf368a4 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Thu, 24 Nov 2022 19:22:49 +0000 Subject: [PATCH] - Fixed the JOIN comparison (instead of putting it in the main query) --- src/Repository.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Repository.php b/src/Repository.php index a9c49a0..c581dd2 100644 --- a/src/Repository.php +++ b/src/Repository.php @@ -611,6 +611,7 @@ class Repository $foreignKey = is_string($annotation->foreignKey) ? $entity::field($annotation->foreignKey, $alias) : $annotation->foreignKey; $this->join("LEFT", $entity::resolveEntity()->tableName(), $key, $foreignKey, $alias, function($join) use ($item, $entity, $alias) { + foreach($this->entityResolver->searchFieldAnnotationList($item, new Where() ) as $condition) { if ( ! is_object($condition->field) ) { $field = $this->entityClass::field($condition->field); @@ -619,14 +620,12 @@ class Repository $field = clone $condition->field; } - /* @TODO FIX THIS ! - * - * if ( $condition->field->entityClass === $entity ) { - if ( $this->entityClass === $entity ) { + # Adding directly + if ( $field->entityClass === $entity ) { $field->alias = $alias; $join->where(is_object($field) ? $field : $entity::field($field, $alias), $condition->value, $condition->operator); - }*/ + } } foreach($this->entityResolver->searchFieldAnnotationList($item, new FilterJoin() ) as $filter) {