Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Custom Relation Model

$
0
0
Hi to everyone

I have two models and I want to have custom relation between them

the foreign key one of them is a part of the other so the below code

public function relations()
{
'relTable' => array(self::BELONGS_TO, 'anotherAr', 'foreign_id'),
}


has to modified appropriate by a condition like
WHERE anotherAr.id LIKE '%foreign_id%'


Is there way to do that in relations Model method or I have to do directly in controller by sql query ?


Thanks

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>