Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

[Solved] - ManyMany Line 92 Issue


Go to End


2 Posts   2717 Views

Avatar
terry.fregoe

Community Member, 2 Posts

1 August 2014 at 4:44am

Edited: 01/08/2014 4:51am

I get this error when trying to save a DataObject with a many_many. Error at line 92 of /home/pnew/public_html/test/framework/model/ManyManyList.php

I can view the Personnel Dataobject and am able to list out the different Departments as check boxes but if I try to save with a checkbox checked I get the error, if I do not try to select a checkbox it will save just fine.

My Code:
Personnel.php

class Personnel extends DataObject{
public static $db = array(
'Salutation' => 'Varchar(5)',
'FirstName' => 'Varchar(50)',
'LastName' => 'Varchar(50)',
'Campus' => 'Varchar(255)',
'College' => 'Varchar(255)',
'School' => 'Varchar(255)',
'WebTitle' => 'Varchar(255)',
'Phone' => 'Varchar(15)',
'BoxNumber' => 'Varchar(6)',
'EmailAddress' => 'Varchar(255)',
'Description' => 'HTMLText',
);

public static $has_one = array(
'Photo' => 'Image',
);

public static $many_many = array(
'Department' => 'Department',
);
...
}

Department.php

class Department extends DataObject{
public static $db = array(
'Name' => 'Varchar(50)',
'AboutDepartment' => 'HTMLText',
'Active' => 'Enum(array("Active","Disabled"))',
);
public static $has_one = array(
'ParentSchool' => 'School',
);

public static $belongs_many_many = array(
'Personnel' => 'Personnel',
);
...
}

Avatar
terry.fregoe

Community Member, 2 Posts

1 August 2014 at 8:12am

Okay Thank you all for attempting to help.

I figured out my issue, I was not passing the ID of the department in the checkboxes so silverstripe had nothing to write to the cross table.