C
C
cat_crash2014-06-19 00:05:28
Yii
cat_crash, 2014-06-19 00:05:28

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

1 answer(s)
I
Ivan Kudinov, 2014-06-25
@cat_crash

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 question

Ask a Question

731 491 924 answers to any question