Answer the question
In order to leave comments, you need to log in
Wrong logic in YII?
Why can't the strings usersdd1 and usersdd2 be concatenated ?
You have to duplicate lines with different names, otherwise it swears at uniqueness.
Don't you think that this is a flaw in the framework?
'usersdd1' => array (self::BELONGS_TO, 'Users', 'userid'),
'clothingsizename'=>array(self::HAS_ONE, 'Clothingsize',array('clothing_size'=>'id'),'through'=>'usersdd1'),
'usersdd2' => array (self::BELONGS_TO, 'Users', 'userid'),
'shoessizesname'=>array(self::HAS_ONE, 'Shoessizes',array('shoes_size'=>'id'),'through'=>'usersdd2'),
Answer the question
In order to leave comments, you need to log in
If you think that this is a flaw in the framework, then no one forbids you to issue an issue on GitHub.
It seems to me that in your case the framework does everything right, but you may have problems with such a base structure later. At a minimum, you are trying to specify relationships for two tables through one field, which cannot be done. Blind connections in some WorkBench and generate models through Gii, see what connections it has generated for you, compare. Unfortunately, I haven’t written in Yii for a long time, so I can’t say more specifically.
Try something like:
'usersdd2' => array (self::BELONGS_TO, array('Users', 'Users2'), 'userid'),
or
'usersdd2' => array (self::BELONGS_TO, 'Users as Users2' , 'userid'),
I don't know how to do it in Yii, but it swears not on the key, but on the value, you connect two identical tables without aliases, this cannot be done in mysql (if I understand what you are doing correctly)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question