7921 Posts in 1359 Topics by 933 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » CheckboxSetField: [User Error] ... the method 'setbyidlist' does not exist on 'DataObjectSet'
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: | 2064 Views |
-
CheckboxSetField: [User Error] ... the method 'setbyidlist' does not exist on 'DataObjectSet'

27 July 2009 at 10:17pm
Hi!
The Edit-Form for my ContentDataObject (in the DataObjectManager) works fine, but if I want to save it, following exception is thrown:
[User Error] Uncaught Exception: Object->__call(): the method 'setbyidlist' does not exist on 'DataObjectSet'
POST /admin/EditForm/field/CurrentContent/item/47/DetailFormLine 515 in ~/sapphire/core/Object.php
Source506 case isset($config['function']) :
507 return $config['function']($this, $arguments);
508
509 default :
510 throw new Exception (
511 "Object->__call(): extra method $method is invalid on $this->class:" . var_export($config, true)
512 );
513 }
514 } else {
515 throw new Exception("Object->__call(): the method '$method' does not exist on '$this->class'");
516 }
517 }
518
519 // -----------------------------------------------------------------------------------------------------------------
520
521 /**Trace
* Object->__call(setByIDList,Array)
* DataObjectSet->setByIDList(Array)
Line 143 of CheckboxSetField.php
* CheckboxSetField->saveInto(EventDataObject)
Line 884 of Form.php
....I have follow DataObjects
class ContentDataObject extends MagazinDataObject {
static $db = array (
);
static $has_many = array (
);
static $many_many = array (
"Categories" => "CategoryDataObject",
);
public function getCMSFields_forPopup() {
$fields = parent::getCMSFIelds_forPopup();
$fields->push(new DateField("ArchivDate", "Archivierungsdatum"));
$fields->push(new DropdownField("ClassName", $this->fieldLabel('ClassName'), $this->getContentTypeClasses('ContentDataObject')));
$contentList = DataObject::get('CategorizationComplexDataObject');
// $fields->push(new CategorizationSetField("Categories", "Kategorien", $contentList));
$fields->push(new CheckboxSetField("Categories", "Kategorien", $contentList->toDropDownMap()));
return $fields;
}
...
}class CategorizationDataObject extends MagazinDataObject {
static $db = array (
);
static $has_one = array(
);
static $belongs_many_many = array (
"Contents" => "ContentDataObject",
);
public function getCMSFields_forPopup() {
$fields = parent::getCMSFields_forPopup();
$fields->push(new DropdownField("ClassName", $this->fieldLabel('ClassName'), $this->getContentTypeClasses('CategorizationDataObject')));
$fields->push(new DropdownField("MagazinPageID", "Single View Page", $this->getMagazinPagesForDropDown()));
// $fields->push(new TextField("Author", "Autor"));
return $fields;
}
...
}Any ideas or hints?
Cheers,
Malte
-
Re: CheckboxSetField: [User Error] ... the method 'setbyidlist' does not exist on 'DataObjectSet'

27 July 2009 at 10:27pm
With
static $many_many = array (
"Categories" => "CategorizationDataObject",
);
...
it also does not work work...Cheers,
Malte -
Re: CheckboxSetField: [User Error] ... the method 'setbyidlist' does not exist on 'DataObjectSet'

27 July 2009 at 11:02pm
I have found problem.
I have overwritten the automatically generated Categories-function with my custom one.
Stupid mistake...
Cheers,
Malte
-
Re: CheckboxSetField: [User Error] ... the method 'setbyidlist' does not exist on 'DataObjectSet'

1 October 2009 at 9:33am
I was running into the same issue... so I thought I'd share my findings with anyone else who may run into the same issue.
If you do need to overwrite the auto-generated function, you could try something like this in your DataObject:
// Code you want but can't use in this situation:
return DataObject::get('<YourObject>', "<filter>", "<sort>", etc);return $this->getManyManyComponents('<YourRelation>', "<filter>", "<sort>", etc);
You could use getComponents or getHasManyComponents too.
Hope it helps someone!!
| 2064 Views | ||
|
Page:
1
|
Go to Top |


