Answer the question
In order to leave comments, you need to log in
Yii: Relation JOIN with MySQL function - how?
Good day.
There is a model that joins with another model via HAS_ONE
..
'url'=>array(self::HAS_ONE,'Urls','',array('URL'=>'SLUG'))
...
How can I make it so that the model was joined using the MySQL transform function to conditionally get a query like:
select * from A left join B on A.URL=urlize(SLUG);
where urlize is a MySQL stored function.
Answer the question
In order to leave comments, you need to log in
Have you tried `CDbExpression`?
'url' => array(self::HAS_ONE, 'Urls', array('URL' => new CDbExpression('urlize(`SLUG`)'))),
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question