Hy. A’m sorry for my bad english. I want relate 2 tables (page and tags). i’m use relation table (page_tags). But than I want get records in view I get array(). Thank’s for help)
$page=Page::model()->findByPk(10);
print_r ($tags=$page->tags);
This is my relations:
model Page
public function relations()
{
return array(
'tags' => array(self::MANY_MANY, 'Tags', 'page_tags(page_id, tag_id)'),
);
}
model Tags
public function relations()
{
return array(
'tags' => array(self::MANY_MANY, 'Page', 'page_tags(tag_id, page_id)'),
);
}