Answer the question
In order to leave comments, you need to log in
How to properly organize link for SphinxIndex in yii2?
Hello everyone, I look here and I can not organize a connection for the index. It gives an error that hasMany (and hasOne) takes 2 arguments, and there (by reference) 3 arguments.
I also tried like this:
use yii\sphinx\ActiveRecord;
class Index extends ActiveRecord
{
... //сгенерировал через gii
public function attributeLabels()
{
return [
'id' => Yii::t('app', 'ID'),
'name' => Yii::t('app', 'Name'),
'parent_id' => Yii::t('app', 'Parent_id'),
];
}
public function getChilds()
{
return $this->hasMany(Index::className(), ['parent_id' => 'id']);
}
}
Answer the question
In order to leave comments, you need to log in
HasMany really has two arguments, something wrong is indicated by the link (most likely the documentation was taken from some alpha versions of chtoli, when the framework was still in development). Here's where to read https://github.com/yiisoft/yii2/tree/master/docs/g...
Here's about relays https://github.com/yiisoft/yii2/blob/master/docs/g.. Personally ,
I have not worked with the sphinx, I can not say anything, but at first glance everything is correct with you. If you would describe the problem in more detail (what exactly does not work - what kind of exception, or something else) - it would be clearer.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question