thinkphp框架升级

This commit is contained in:
devil_gong
2019-11-11 14:37:00 +08:00
parent 27540686b3
commit 820030d987
55 changed files with 844 additions and 341 deletions

View File

@ -11,6 +11,7 @@
namespace think\model\relation;
use Closure;
use think\db\Query;
use think\Exception;
use think\Loader;
@ -87,7 +88,7 @@ abstract class OneToOne extends Relation
$joinOn = $name . '.' . $this->localKey . '=' . $joinAlias . '.' . $this->foreignKey;
}
if ($closure) {
if ($closure instanceof Closure) {
// 执行闭包查询
$closure($query);
// 使用withField指定获取关联的字段
@ -311,7 +312,7 @@ abstract class OneToOne extends Relation
protected function eagerlyWhere($where, $key, $relation, $subRelation = '', $closure = null)
{
// 预载入关联查询 支持嵌套预载入
if ($closure) {
if ($closure instanceof Closure) {
$closure($this->query);
if ($field = $this->query->getOptions('with_field')) {