Hello,
How can i retrieve the the values of relational object in form, when i edit ?
In model i have:
$this->hasManyToMany(
"id",
"ArticlesCategories",
"article_id",
"category_id",
"Category",
"id",
array('alias' => 'categories')
);
In form i have:
$this->add(new Text('title'))
->add(new Text('slug'))
->add(new Text('tags'))
->add(new TextArea('content'));
$this->add(new Select('is_published', array(
1 => $translate['Yes'],
0 => $translate['No']
)));
$this->add(new Select('categories', Category::find(), array(
'using' => array('id', 'name'),
'value' => ???
)));
I don't know how can i get the the categories assigned to the current article. Any help please ? PS: I tried $this->getEntity()->categories . But i got stuck.