We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, there is an issue with the new alias() function in Yii 2.0.7.
alias()
If you use an alias for the primary table the function anyTagValuesin the class TaggableQueryBehavior returns an error.
anyTagValues
TaggableQueryBehavior
I think you should change the function in this way:
public function anyTagValues($values, $attribute = null) { $model = new $this->owner->modelClass(); $query = $this->owner; $tagClass = $model->getRelation($model->tagRelation)->modelClass; $this->owner ->innerJoinWith($model->tagRelation, false) ->andWhere([$tagClass::tableName() . '.' . ($attribute ?: $model->tagValueAttribute) => $model->filterTagValues($values)]) ->addGroupBy(array_map(function ($pk) use ($model,$query) { return array_search($model->tableName(),$query->from) . '.' . $pk; }, $model->primaryKey())); return $this->owner; }
You don't have to get the table name from $model->tableName()but from the $from variable in the ActiveQuery object.
$model->tableName()
$from
ActiveQuery
regards
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
there is an issue with the new
alias()
function in Yii 2.0.7.If you use an alias for the primary table the function
anyTagValues
in the classTaggableQueryBehavior
returns an error.I think you should change the function in this way:
You don't have to get the table name from
$model->tableName()
but from the$from
variable in theActiveQuery
object.regards
The text was updated successfully, but these errors were encountered: