修正HasManyThrough关联

This commit is contained in:
thinkphp
2016-12-13 16:50:28 +08:00
parent 381f90a735
commit 5c1c1d5f60

View File

@@ -21,6 +21,8 @@ class HasManyThrough extends Relation
{
// 中间关联表外键
protected $throughKey;
// 中间表模型
protected $through;
/**
* 架构函数
@@ -37,7 +39,7 @@ class HasManyThrough extends Relation
{
$this->parent = $parent;
$this->model = $model;
$this->middle = $through;
$this->through = $through;
$this->foreignKey = $foreignKey;
$this->throughKey = $throughKey;
$this->localKey = $localKey;
@@ -90,7 +92,7 @@ class HasManyThrough extends Relation
protected function baseQuery()
{
if (empty($this->baseQuery)) {
$through = $this->middle;
$through = $this->through;
$model = $this->model;
$alias = Loader::parseName(basename(str_replace('\\', '/', $model)));
$throughTable = $through::getTable();