7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Can't figure out how-to ManyManyFileDataObjectManager
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: | 791 Views |
-
Can't figure out how-to ManyManyFileDataObjectManager

5 April 2010 at 12:26am
Hey All
Major brainfreeze I think. Really struggling to implement a ManyManyFileDataObjectManager.
I have a 'ResourcePage' which I would like to have a many-many relationship with a subclass of File, 'ResourceFile'.
ResourcePage has manymany of 'ResourceFiles' => 'ResourceFile' and Resource File has a belongs_many_many of 'ResourcePages' => 'ResourcePage' and the following is how I'm trying to initialise the ManyManyFileDOM.
new ManyManyFileDataObjectManager(
$this,
'ResourceFiles',
'ResourceFile',
'ResourcePages',
array(
'Name' => 'Name'
),
'getCMSFields_forPopup'
);But TBH the above is me just taking a stab in the dark after many attempts. The error I get when trying to create a ResourcePage in the CMS is:
ERROR [Warning]: Missing argument 3 for FileDataObjectManager_Item::__construct(), called in /path/to/www/sapphire/forms/ComplexTableField.php on line 297 and defined
IN POST /admin/getitem?ID=108&ajax=1
Line 648 in /path/to/www/dataobject_manager/code/FileDataObjectManager.phpIs anyone able to correct the above code, or rather and preferably, show me an example of a working HasMany / ManyManyFileDataObjectManager? Would be most excellent.
Also, I'm currently using 2.4rc1.
-
Re: Can't figure out how-to ManyManyFileDataObjectManager

5 April 2010 at 2:12am
First, you can't manage a relationship directly to File objects or subclasses thereof. You need to create a DataObject that contains a file, as shown in the documentation for FileDOM.
Also, around r380 or so, the source code was branched to support 2.4 and 2.3. 2.4 is on the trunk, so make sure you're on the latest rev.
-
Re: Can't figure out how-to ManyManyFileDataObjectManager

5 April 2010 at 3:06am
Hi UncleCheese
Thanks for your reply. I knew there would be some big forehead-slap worthy thing that I had missed. Gosh. I'll give it a whirl in the morning and hopefully all should be fine.
I'm pretty sure I'm on the latest or close-to rev, but will run an update to be sure, thanks.
Cheers
dizzy
| 791 Views | ||
|
Page:
1
|
Go to Top |

