eee
This commit is contained in:
+4
-4
@@ -253,7 +253,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, \
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
$query = new ActiveQuery($model = static::instance());
|
$query = new ActiveQuery($model = static::instance());
|
||||||
$query->from($model->getTable())->alias('t1');
|
$query->from($model->getTable());
|
||||||
if (is_numeric($param)) {
|
if (is_numeric($param)) {
|
||||||
$query->where([$model->getPrimary() => +$param]);
|
$query->where([$model->getPrimary() => +$param]);
|
||||||
} else if (is_array($param)) {
|
} else if (is_array($param)) {
|
||||||
@@ -279,7 +279,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, \
|
|||||||
{
|
{
|
||||||
$model = static::instance();
|
$model = static::instance();
|
||||||
$query = new ActiveQuery($model);
|
$query = new ActiveQuery($model);
|
||||||
$query->from($model->getTable())->alias('t1')->where([$model->getPrimary() => $param]);
|
$query->from($model->getTable())->where([$model->getPrimary() => $param]);
|
||||||
return $query->first();
|
return $query->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,7 +324,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, \
|
|||||||
public static function all(string|array $condition): Collection
|
public static function all(string|array $condition): Collection
|
||||||
{
|
{
|
||||||
$model = new ActiveQuery(static::instance());
|
$model = new ActiveQuery(static::instance());
|
||||||
$model->from($model->getTable())->alias('t1');
|
$model->from($model->getTable());
|
||||||
if (is_array($condition)) {
|
if (is_array($condition)) {
|
||||||
$model->where($condition);
|
$model->where($condition);
|
||||||
} else {
|
} else {
|
||||||
@@ -341,7 +341,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, \
|
|||||||
public static function query(): ActiveQuery
|
public static function query(): ActiveQuery
|
||||||
{
|
{
|
||||||
$model = new ActiveQuery(static::instance());
|
$model = new ActiveQuery(static::instance());
|
||||||
$model->select()->from($model->getTable())->alias('t1');
|
$model->select()->from($model->getTable());
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ abstract class QueryTrait extends Component implements ActiveQueryInterface, ISq
|
|||||||
return $this->where;
|
return $this->where;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public array $select = ['t1.*'] {
|
public array $select = ['*'] {
|
||||||
&get {
|
&get {
|
||||||
return $this->select;
|
return $this->select;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user