- WIP on attributes
This commit is contained in:
1 parent
e6d0279c1a
commit
70021d829d
13 files changed
+174
-36
No files matched your search
@@ -48,7 +48,7 @@ class QueryBuilder implements Query\QueryBuilderInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function select($field, bool $distinct = false) : self
|
||||
public function select(string|\Stringable|array $field, bool $distinct = false) : self
|
||||
{
|
||||
if ( null !== ( $select = $this->getFragment(Query\Select::class) ) ) {
|
||||
$select->add($field);
|
||||
@@ -195,7 +195,7 @@ class QueryBuilder implements Query\QueryBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function where(/* stringable*/ $field, $value, string $operator = Query\Where::OPERATOR_EQUAL, string $condition = Query\Where::CONDITION_AND, bool $not = false) : self
|
||||
public function where(string|\Stringable $field, $value, string $operator = Query\Where::OPERATOR_EQUAL, string $condition = Query\Where::CONDITION_AND, bool $not = false) : self
|
||||
{
|
||||
# Empty IN case
|
||||
if ( [] === $value ) {
|
||||
@@ -217,12 +217,12 @@ class QueryBuilder implements Query\QueryBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function notWhere($field, $value, string $operator = Query\Where::CONDITION_AND) : self
|
||||
public function notWhere(string|\Stringable $field, $value, string $operator = Query\Where::CONDITION_AND) : self
|
||||
{
|
||||
return $this->where($field, $value, $operator, true);
|
||||
}
|
||||
|
||||
public function having($field, $value, string $operator = Query\Where::OPERATOR_EQUAL, string $condition = Query\Where::CONDITION_AND, bool $not = false) : self
|
||||
public function having(string|\Stringable $field, $value, string $operator = Query\Where::OPERATOR_EQUAL, string $condition = Query\Where::CONDITION_AND, bool $not = false) : self
|
||||
{
|
||||
if ( $this->having ?? false ) {
|
||||
$having = $this->having;
|
||||
@@ -266,7 +266,7 @@ class QueryBuilder implements Query\QueryBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function orderBy(string $field, ? string $direction = null) : self
|
||||
public function orderBy(string|\Stringable $field, ? string $direction = null) : self
|
||||
{
|
||||
if ( null === $orderBy = $this->getFragment(Query\OrderBy::class) ) {
|
||||
$orderBy = new Query\OrderBy();
|
||||
@@ -278,7 +278,7 @@ class QueryBuilder implements Query\QueryBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function groupBy(string $field, ? string $direction = null) : self
|
||||
public function groupBy(string|\Stringable $field, ? string $direction = null) : self
|
||||
{
|
||||
if ( null === $groupBy = $this->getFragment(Query\GroupBy::class) ) {
|
||||
$groupBy = new Query\GroupBy();
|
||||
@@ -290,14 +290,14 @@ class QueryBuilder implements Query\QueryBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function join(string $type, /*string | QueryBuilder*/ $table, $field, $value, bool $outer = false, ? string $alias = null) : self
|
||||
public function join(string $type, /*string | QueryBuilder*/ $table, mixed $field, mixed $value, bool $outer = false, ? string $alias = null) : self
|
||||
{
|
||||
$this->withJoin(...func_get_args());
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function withJoin(string $type, $table, $field, $value, bool $outer = false, ? string $alias = null) : Query\Join
|
||||
public function withJoin(string $type, $table, mixed $field, mixed $value, bool $outer = false, ? string $alias = null) : Query\Join
|
||||
{
|
||||
$join = new Query\Join($this);
|
||||
|
||||
|
||||
Reference in new issue
Block a user