public function getTableName()
    {
        if (!$this->through) {
            $parts = [
                TableNameResolver::getTableName($this->getTable()),
                TableNameResolver::getTableName($this->getRelatedTable()),
            ];
            sort($parts);

            return '{{%'.implode('_', $parts).'}}';
        }

        return call_user_func([$this->through, 'tableName']);
    }