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

Add Extra Attribute In Model

$
0
0
Hi Everyone

I want to add extra attribute in Model from another table
but I don't want to generate a related Model AR for the last one table

for example

If I have the AR Model for table related_table I could use
 public function relations() {
        return array(
            'product' => array(self::BELONGS_TO, 'relatedTableAR', 'relId')
        )
)


How could achieve the similar but directly to the table (without relatedTableAR)

like this

 public function relations() {
        return array(
            //'product' => array(self::BELONGS_TO, 'relatedTableAR', 'relId')
 'Products' => array(self::BELONGS_TO, ':related_table', '' , 'on'=>'related_table.id=t.rel_id','select'=>'id,price'), 
        )
)



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>