修正远程一对多

This commit is contained in:
thinkphp
2017-05-21 09:23:47 +08:00
parent 253f2bfc7b
commit c34a9153e3

View File

@@ -130,10 +130,9 @@ class HasManyThrough extends Relation
{
if (empty($this->baseQuery) && $this->parent->getData()) {
$through = $this->through;
$model = $this->model;
$alias = Loader::parseName(basename(str_replace('\\', '/', $model)));
$alias = Loader::parseName(basename(str_replace('\\', '/', $this->model)));
$throughTable = $through::getTable();
$pk = (new $this->model)->getPk();
$pk = (new $through)->getPk();
$throughKey = $this->throughKey;
$modelTable = $this->parent->getTable();
$this->query->field($alias . '.*')->alias($alias)