This commit is contained in:
2024-12-13 14:04:58 +08:00
parent f084c171ff
commit b3e3e95081
+19 -6
View File
@@ -23,14 +23,15 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
public bool $asArray = FALSE;
protected mixed $_mock = null;
protected mixed $_mock = NULL;
/**
* @param bool $asArray
*
* @return static
*/
public function asArray(bool $asArray = true): static
public function asArray(bool $asArray = TRUE): static
{
$this->asArray = $asArray;
return $this;
@@ -38,6 +39,7 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
/**
* @param array $methods
*
* @return $this
*/
public function with(array $methods): static
@@ -57,7 +59,7 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
if (is_array($data)) {
return $this->populate($data);
}
return null;
return NULL;
}
/**
@@ -69,13 +71,14 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
if (is_array($data)) {
return new Collection($this, $this->modelClass, $data);
}
return false;
return FALSE;
}
/**
* @param string $column
* @param int|float $amount
*
* @return bool
*/
public function increment(string $column, int|float $amount = 1): bool
@@ -86,6 +89,7 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
/**
* @param array $attributes
*
* @return bool
*/
public function increments(array $attributes): bool
@@ -97,6 +101,7 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
/**
* @param string $column
* @param int|float $amount
*
* @return bool
*/
public function decrement(string $column, int|float $amount = 1): bool
@@ -107,6 +112,7 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
/**
* @param array $attributes
*
* @return bool
*/
public function decrements(array $attributes): bool
@@ -127,6 +133,7 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
/**
* @param int $size
* @param Closure $closure
*
* @return void
*/
public function chunk(int $size, Closure $closure): void
@@ -151,7 +158,7 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
*
* @return array|null
*/
public function column(string $field, ?string $setKey = null): ?array
public function column(string $field, ?string $setKey = NULL): ?array
{
return $this->get()->column($field, $setKey);
}
@@ -159,6 +166,7 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
/**
* @param mixed $value
*
* @return $this
*/
public function withMock(mixed $value): static
@@ -179,6 +187,7 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
/**
* @param array $data
*
* @return ModelInterface|array
* @throws
*/
@@ -211,13 +220,14 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
/**
* @param array $data
*
* @return bool
* @throws
*/
public function update(array $data): bool
{
if (count($data) < 1) {
return true;
return TRUE;
}
$generate = $this->builder->update($data);
if (!is_bool($generate)) {
@@ -229,6 +239,7 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
/**
* @param array $data
*
* @return bool
*/
public function insert(array $data): bool
@@ -238,6 +249,7 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
return (bool)$this->buildCommand($sql)->exec();
}
/**
* @param string $filed
*
@@ -262,6 +274,7 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
/**
* @param string $sql
* @param array $params
*
* @return int|bool
*/
public function execute(string $sql, array $params = []): int|bool