7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Bug while calling the ManyManyDataObjectManager
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | Next > | |
| Author | Topic: | 1721 Views |
-
Bug while calling the ManyManyDataObjectManager

12 June 2009 at 11:34pm
I Just wanted to display a ManyMany-Relation with the ManyManyDataObjectManager.
But I always get following error:
Fatal error: Access to undeclared static property: ViewableData::$many_many in ~\sapphire\core\Object.php(376) : eval()'d code on line 1My DataObject looks like this:
class ContentDataObject extends DataObject {
static $db = array (
"Title" => "Varchar(255)",
//...
);
static $many_many = array (
"Connections" => "ArticleDataObject",
);
static $belongs_many_many = array (
"ConnectionsBelongs" => "ContentDataObject",
);
}The Manager in the Page looks like this (If I replace "ManyManyDataObjectManager" with "DataObjectManager" is working):
$manager = new ManyManyDataObjectManager(
$this,
'CurrentContent',
'ContentDataObject',
$this->getListedFields(),
'getCMSFields_forPopup'
);
return $manager;System:
SS 2.3.1
dataobject_manager r117Any ideas how to solve the error?
Cheers,
Malte
-
Re: Bug while calling the ManyManyDataObjectManager

13 June 2009 at 1:24am
Looks like you've probably set up your model wrong. Paste in all of your code for the Page object.
-
Re: Bug while calling the ManyManyDataObjectManager

13 June 2009 at 2:22am
Hi UncleCheese,
thanks for your fast reply.
Here is the PageObject...class MagazinDataPage extends DataPage
{
static $db = array (
);
static $has_many = array (
'Content' => 'ContentDataObject'
);
static $allowed_children = array("MagazinDataPage");
public function getCMSFields($cms) {
$fields = parent::getCMSFields($cms);
// $fields->addFieldToTab("Root.Content.Current", $this->getCurrentContentManager());
// $fields->addFieldToTab("Root.Content.LastChanged", $this->getStoreManager());
// $fields->addFieldToTab("Root.Content.Archiv", $this->getZIPManager());
$fields->addFieldToTab("Root.Content.All", $this->getAllContentManager());
return $fields;
}
protected function getAllContentManager() {
$manager = new ManyManyDataObjectManager(
$this,
'CurrentContent',
'ContentDataObject',
$this->getListedFields(),
'getCMSFields_forPopup'/*,
"MagazinDataPageID = {$this->ID}"*/
);
// $manager->setParentClass('MagazinDataPage');
$manager->setFilter("ClassName", "ContentType", ContentDataObject::getContentTypeClasses());
return $manager;
}
protected function getListedFields() {
return array(
"ClassName" => "ContentType",
"Title" => "Titel",
"ShowOn" => "Erscheinungsdatum",
"Disabled" => "Versteckt",
"HideOn"=> "Ausblendungsdatum"
);
}
}class MagazinDataPage_Controller extends DataPage_Controller
{}
Cheers,
Malte
-
Re: Bug while calling the ManyManyDataObjectManager

13 June 2009 at 3:16am
Yeah, you've set up your model wrong.
Page => $many_many DataObjects
DataObject => $belongs_many_many PagesManyManyDOM
$this,
'NameOfDataObjects',
'DataObjectClassName' -
Re: Bug while calling the ManyManyDataObjectManager

13 June 2009 at 7:23pm
But than my Konzept does not work.
I would like to have
Page => $has_many DataObjects
DataObject => $has_one PageDataObject => $many_many DataObjects
DataObject => $belongs_many_many DataObjectsSo a DataObect is stored in one Page.
And all DataObjects can be connected to each other.How can I solve this? I don't want to have each DataObject as Page or did I get something wrong?
Cheers,
Malte
-
Re: Bug while calling the ManyManyDataObjectManager

14 June 2009 at 9:43am
If you're relating dataobjects to a dataobject, you need to use a CheckboxSetField in your popup form. The ManyManyDataObjectManager is used for attaching DataObjects to Pages. If those DataObjects have their own sets of relationships, they are handled in the edit window for each of those objects -- not in the MMDOM.
-
Re: Bug while calling the ManyManyDataObjectManager

17 June 2009 at 9:35pm
Thanks for your help.
Generally it works, but if you have more than 20 Objects available. It's not managable anymore.
I have to rework this part of my concept. -
Re: Bug while calling the ManyManyDataObjectManager

18 June 2009 at 1:46am
You MIGHT have some luck with the MultiSelectField here http://www.silverstripe.org/multiselectfield-module/ which is built for this sort of thing. I'd say there's a 50% chance it will fail in a popup window, though.
Worth a shot!
| 1721 Views | ||
| Go to Top | Next > |

