Jump to:

5554 Posts in 1742 Topics by 1227 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Cannot edit relationship

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 279 Views
    Community Member
    2 Posts

    Cannot edit relationship Link to this post


    Is it possible to edit relationship using ListboxField? According to the documentation it is (AFAIU saveInto() tries to edit relationship), but it doesn't work for me.
    Every time I try to create a new record, every item (every Category) is selected in ListboxField.
    Saving does not work too - it does not do anything (but there are no errors too).

    So the code is:


    class Event extends Page {

       static $default_parent = 'EventList';

       static $can_be_root = false;

       public static $db = array(...);

       public static $many_many = array(
          "Categories" => "Category",

       public function getCMSFields() {

          $categoryList = DataObject::get_one("CategoryList");
          $categories = Category::get()->where("ParentID = '".$categoryList->ID."'")->map()->toArray();
             ListboxField::create('Categories', 'Categories')
          , 'Content');


          return $fields;


    class Category extends Page {

       static $default_parent = 'CategoryList';

       static $can_be_root = false;

       public static $db = array(

       public static $belongs_many_many = array(
          "Events" => "Event",


Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.