yii2-taggable icon indicating copy to clipboard operation
yii2-taggable copied to clipboard

Not working setting orderAttribute to false

Open roro15 opened this issue 8 years ago • 0 comments

Hello! I suppose doesn't work setting $orderAttribute to "false" in class TaggableBehavior. If is setting it to false i have an error when searching tags:

        return $tc::find()->innerJoin($this->junctionTable . ' j', [ $tpk => $tkn ])
            ->where(['j.' . $this->modelKeyAttribute => $ownerPk])
            ->orderBy('j.' . $this->orderAttribute);

in method TaggableBehavior::getTags(). Thing there should be something like that:

        $query = $tc::find()->innerJoin($this->junctionTable . ' j', [ $tpk => $tkn ])
            ->where(['j.' . $this->modelKeyAttribute => $ownerPk]);
        if ($this->orderAttribute) {
            $query->orderBy('j.' . $this->orderAttribute);
        }
        return $query;

roro15 avatar Jun 15 '16 10:06 roro15