think\model\Relation::hasManyThrough PHP Метод

hasManyThrough() публичный Метод

HAS MANY 远程关联定义
public hasManyThrough ( string $model, string $through, $foreignKey, $throughKey, string $localKey, array $alias )
$model string 模型名
$through string 中间模型名
$localKey string 关联主键
$alias array 别名定义
    public function hasManyThrough($model, $through, $foreignKey, $throughKey, $localKey, $alias)
    {
        // 记录当前关联信息
        $this->type = self::HAS_MANY_THROUGH;
        $this->model = $model;
        $this->middle = $through;
        $this->foreignKey = $foreignKey;
        $this->throughKey = $throughKey;
        $this->localKey = $localKey;
        $this->alias = $alias;
        $this->query = (new $model())->db();
        // 返回关联的模型对象
        return $this;
    }