Hi,
I've just install SilverStripe 2.3 RC2 and I'm trying the real interesting new feature : ModelAdmin
It work real properly with one to many relationship but doesn't work with many_many.
Here are my classes :
final class Book extends DataObject
{
static $db = array(
'Label' => 'Varchar',
'ISBN' => 'Varchar',
);
static $has_one = array(
'author' => 'Author'
);
static $searchable_fields = array(
'Label',
'ISBN',
);
static $summary_fields = array(
'Label',
'ISBN',
'author'
);
static $belongs_many_many = array(
'categories' => 'Category',
);
}
final class Category extends DataObject
{
static $db = array(
'label' => 'Varchar',
);
static $many_many = array(
'books' => 'Book',
);
}
Here is the code for model admins :
class BookAdmin extends ModelAdmin
{
protected static $managed_models = array(
'Book'
);
static $url_segment = 'books';
static $menu_title = 'Admin books';
}
class CategoryAdmin extends ModelAdmin
{
protected static $managed_models = array(
'Category'
);
static $url_segment = 'categories';
static $menu_title = 'Admin categories';
}
When I've build my db and flush everything I can see Category tab on Book's edit view, but can't add categories on it.
Is something wrong with my code?