This commit is contained in:
2024-12-12 12:10:19 +08:00
parent 7ca732f153
commit f084c171ff
3 changed files with 1023 additions and 957 deletions
+9
View File
@@ -190,6 +190,15 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
} }
/**
* @return string
*/
public function toSql(): string
{
return $this->builder->get();
}
/** /**
* @return int * @return int
* @throws * @throws
+999 -952
View File
File diff suppressed because it is too large Load Diff
+15 -5
View File
@@ -1,13 +1,23 @@
<?php <?php
use Database\Query;
class Users extends \Database\Model class Users extends \Database\Model
{ {
public function hasD()
{
return $this->hasOne(static::class, 'id', 'id')->with([]);
}
}
public function hasD() Users::query()
{ ->select(['*', (new Query(Users::class))
return $this->hasOne(static::class, 'id', 'id')->with([]); ->where(['id' => 2])])
} ->from(function (Query $query) {
} $query->from(Users::class)
->where(['id' => 1])
->groupBy('name DESC');
})->toSql();