eee
This commit is contained in:
+21
-1
@@ -75,7 +75,7 @@ abstract class QueryTrait extends Component implements ActiveQueryInterface, ISq
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Closure|string $callback
|
* @param Closure|Query $callback
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
@@ -94,6 +94,26 @@ abstract class QueryTrait extends Component implements ActiveQueryInterface, ISq
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Closure|Query $callback
|
||||||
|
* @param array $attributes
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function whereExists(Closure|Query $callback, array $attributes = []): static
|
||||||
|
{
|
||||||
|
if ($callback instanceof Query) {
|
||||||
|
$this->where[] = 'EXISTS(' . $callback->build() . ')';
|
||||||
|
} else {
|
||||||
|
$this->where[] = 'EXISTS(' . $this->makeClosureFunction($callback) . ')';
|
||||||
|
}
|
||||||
|
if (count($attributes) > 0) {
|
||||||
|
$this->bindParams($attributes);
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $select
|
* @param array $select
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user