eee
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace Database\Affair;
|
||||
|
||||
use Exception;
|
||||
|
||||
class Commit
|
||||
{
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ use Kiri\Abstracts\Component;
|
||||
use Kiri\Di\Container;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use PDO;
|
||||
use PDOStatement;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Database\Condition;
|
||||
|
||||
use Database\ActiveQuery;
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Database\Condition;
|
||||
|
||||
use Kiri\Core\Str;
|
||||
|
||||
/**
|
||||
* Class LLikeCondition
|
||||
* @package Database\Condition
|
||||
|
||||
@@ -3,8 +3,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Database\Condition;
|
||||
|
||||
use Kiri\Core\Str;
|
||||
|
||||
/**
|
||||
* Class LikeCondition
|
||||
* @package Database\Condition
|
||||
|
||||
@@ -3,8 +3,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Database\Condition;
|
||||
|
||||
use Kiri\Core\Str;
|
||||
|
||||
/**
|
||||
* Class NotLikeCondition
|
||||
* @package Database\Condition
|
||||
|
||||
@@ -3,8 +3,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Database\Condition;
|
||||
|
||||
use Kiri\Core\Str;
|
||||
|
||||
/**
|
||||
* Class RLikeCondition
|
||||
* @package Database\Condition
|
||||
|
||||
@@ -18,7 +18,6 @@ use Database\Mysql\Schema;
|
||||
use Exception;
|
||||
use Kiri;
|
||||
use Kiri\Server\Events\OnWorkerExit;
|
||||
use Kiri\Waite;
|
||||
use Kiri\Abstracts\Component;
|
||||
use Kiri\Di\Context;
|
||||
use Kiri\Pool\Pool;
|
||||
|
||||
@@ -107,7 +107,7 @@ class Model extends Base\Model
|
||||
/** @var static $select */
|
||||
$select = static::query()->where($condition)->first();
|
||||
if ($select === null) {
|
||||
$select = static::populate(array_merge($condition, $attributes))->create();
|
||||
$select = static::populate(array_merge($condition, $attributes))->save();
|
||||
}
|
||||
return $select;
|
||||
}, $condition, $attributes);
|
||||
@@ -129,7 +129,8 @@ class Model extends Base\Model
|
||||
if (empty($select)) {
|
||||
$select = static::populate($condition);
|
||||
}
|
||||
return $select->save($attributes);
|
||||
$select->attributes = $attributes;
|
||||
return $select->save();
|
||||
}, $condition, $attributes);
|
||||
}
|
||||
|
||||
|
||||
+4
-9
@@ -54,8 +54,8 @@ class Pagination extends Component
|
||||
{
|
||||
unset($this->activeQuery, $this->_callback, $this->_group);
|
||||
$this->_offset = 0;
|
||||
$this->_limit = 100;
|
||||
$this->_max = 0;
|
||||
$this->_limit = 100;
|
||||
$this->_max = 0;
|
||||
$this->_length = 0;;
|
||||
}
|
||||
|
||||
@@ -196,14 +196,9 @@ class Pagination extends Component
|
||||
if ($this->_max > 0 && $this->_length + $this->_limit > $this->_max) {
|
||||
$this->_limit = $this->_length + $this->_limit - $this->_max;
|
||||
}
|
||||
$data = $this->activeQuery->offset($this->_offset)->limit($this->_limit)->get();
|
||||
$data = $this->activeQuery->offset($this->_offset)->limit($this->_limit)->get();
|
||||
$this->_offset += $this->_limit;
|
||||
|
||||
if (is_array($data)) {
|
||||
$size = count($data);
|
||||
} else {
|
||||
$size = $data->size();
|
||||
}
|
||||
$size = $data->size();
|
||||
$this->_length += $size;
|
||||
return [$size, $data];
|
||||
}
|
||||
|
||||
@@ -648,9 +648,6 @@ trait QueryTrait
|
||||
*/
|
||||
public function pushParam(mixed $value): static
|
||||
{
|
||||
// if (is_string($value)) {
|
||||
// $value = addslashes($value);
|
||||
// }
|
||||
$this->attributes[] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,10 @@ namespace Database\Traits;
|
||||
interface Relation
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get(): mixed;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user