I have trouble with relations in my application. I have following tables:
post:
id | title | text | label
1 | lala | lala | 1
post_label:
id | name
1 | security
2 | other
two models: Post, PostLabel
and relation in post model:
'postLabel' => array(self::HAS_ONE, 'PostLabel', 'id'),
When i use this:
$model=$this->loadModel('Post',1);
var_dump($model->postLabel);
it returns NULL, but when i use:
$model=$this->loadModel('Post',1);
var_dump($model->title);
it returns 'lala'
Where I made mistake?
Edit: I see in sql query there is using post id, but not label id. How to change this?
$modelnull or$model->postLabel? Please post the resulting SQL query. - KaipostLabel.idASt1_c0,postLabel.nameASt1_c1FROMpost_labelpostLabelWHERE (postLabel.id='1009')`" - andrzej1_1