7921 Posts in 1359 Topics by 933 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » "Cannot instantiate abstract class Object" when using ManyManyDataObjectManager
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1578 Views |
-
"Cannot instantiate abstract class Object" when using ManyManyDataObjectManager

2 July 2010 at 12:15pm
Hi All,
I'm forking the Calendar_Event module to produce a SportsEvent calendar with custom searching.
I've added a Sport DataObject with the following code:
class Sport extends DataObject {
static $db = array (
"Name" => "Text"
);static $has_one = array ();
static $belongs_many_many = array (
"Events" => "CalendarEvent"
);static $summary_fields = array (
"Name"
);public function getCMSFields_forPopup(){
$fields = new FieldSet ();
$fields->push ( new TextField ( 'Name', 'Sport Name' ));
return $fields;
}
}and I've updated the settings in CalendarEvent as follows:
static $many_many = array (
'RecurringDaysOfWeek' => 'RecurringDayOfWeek',
'RecurringDaysOfMonth' => 'RecurringDayOfMonth',
"Sports" => "Sport"
);My MMDOM code is:
$sportsTable = new ManyManyDataObjectManager (
$this,
"Event Sports",
"Sport",
array (
"Name" => "Sport Name"
),
"getCMSFields_forPopup"
);
$sportsTable->setParentClass("CalendarEvent");
$sportsTable->setAddTitle ("a Sport");
$f->addFieldToTab ( "Root.Content.Sports", $sportsTable );But I'm getting the error "Fatal error: Cannot instantiate abstract class Object in /home/www/sportspost/sportspost.co.nz/sapphire/core/Object.php on line 115" whenever I try to use the CMS. I've narrowed it down to the MMDOM call but I can't seems to work out where I am going wrong in my code.
Can anyone help?
Cheers
James. -
Re: "Cannot instantiate abstract class Object" when using ManyManyDataObjectManager

2 July 2010 at 12:40pm
This is incorrect:
$sportsTable = new ManyManyDataObjectManager (
$this,
"Event Sports",
"Sport",
array (
"Name" => "Sport Name"
),
"getCMSFields_forPopup"
);Check your second and third arguments.
-
Re: "Cannot instantiate abstract class Object" when using ManyManyDataObjectManager

2 July 2010 at 12:52pm
Thank you! Couldn't see the wood for the trees. Changed the second argument to "Sports" and all is serene!
| 1578 Views | ||
|
Page:
1
|
Go to Top |

