Jump to:

7938 Posts in 1541 Topics by 945 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » ManyManyDataObjectManager throws Error

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 455 Views
  • michito
    Avatar
    Community Member
    4 Posts

    ManyManyDataObjectManager throws Error Link to this post

    Hi everyone,

    sorry to bother, but I can't figure out what the problem is here. Basically I want to connect one DataObject (Event) to several other ones (Info). Seems to be a pretty basic failure by me, but I don't get it. It works with $has_one and HasOneDataObjectManager but that way I can only connect one DataObject to another…

    BTW: HasManyDataObjectManager doesn't work either. And yes, I did ?flush=1

    Here ist my code, help is very appreciated.

    Event.php

    class Event extends DataObject
    {
    static $db = array (
    ...
       );
       
       static $has_one = array (
          'Events' => 'EventsPage',
       );
       
       static $has_many = array (
          'Infos' => 'Info'
       );
       
       public static $singular_name = "Event";
       public static $plural_name = "Events";
       
       public function getCMSFields_forPopup()
       {
          return new FieldSet(
             ...
             new ManyManyDataObjectManager($this, 'Infos', 'Info', array('Title' => 'Titel'), 'getCMSFields')
          );
       }
    }

    Info.php

    class Info extends DataObject
    {
    static $db = array (
          ...
       );
       
       static $has_one = array (
          'Info' => 'Eventspage',
          'Bild' => 'Image'
       );
       
       static $belongs_many_many = array (
          'Events' => 'Event'
       );
       
       public function getCMSFields_forPopup()
       {
          return new FieldSet(
             ...
          );
       }
    }

    The Error I'm getting is:

    [Warning] Missing argument 1 for DataObject::get(), called in .../SilverStripe/sapphire/core/ViewableData.php on line 112 and defined
    GET .../SilverStripe/admin/EditForm/field/Events/item/1/edit?SecurityID=14e29ad56b1e0e948f1ed3189c4727c143a3737e&ctf[Events][start]=0&ctf[Events][per_page]=10&ctf[Events][showall]=0&ctf[Events][sort]=StartDate&ctf[Events][sort_dir]=DESC&ctf[Events][search]=&ctf[Events][filter]=

    Line 2713 in .../SilverStripe/sapphire/core/model/DataObject.php

    Thanks in advance.

    455 Views
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.