Answer the question
In order to leave comments, you need to log in
Override find method via function in Model?
Good day everyone!
I connected this extension here: https://github.com/OmgDef/yii2-multilingual-behavior
In modules\catalog\models\Item.php - I connected the behavior
The author of this extension ask to override the find() method in the model, like this
public static function find()
{
return new MultilingualQuery(get_called_class());
}
public static function find()
{
$q = new MultilingualQuery(get_called_class());
$q->multilingual();
return $q;
}
$model = Item::findOne($id);
$model = new Item;
$model = $model->findMultilingual($id);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question