Hello to all! There are Object models, and ObjectUserData.
In the Object model, there is an id field, which is a foreign key, and there is an orig_id field, which is not a foreign key.
The ObjectUserData model has id fields (the record id in the table), and orig_id (refers to orig_id in the Object model). I need to establish a one-to-one relationship so that Object can access the ObjectUserData record by orig_id.
Made a connection in the Object model like this:
'userData' => array(self::HAS_ONE, 'ObjectUserData', 'orig_id'),
But as a result, the query gets this (part of the query is shown):
LEFT OUTER JOIN `objects_user_data` `userData` ON ( `userData`.`orig_id` = `t`.`id` )
where t
is the alias for the table represented by the Objects model.
Although it should end up with this:
LEFT OUTER JOIN `objects_user_data` `userData` ON ( `userData`.`orig_id` = `t`.`orig_id` )
I understand that the Nubian question, I would have written this request myself without any problems, but I don’t understand how to submit it to AR :(