Silverstripe images have a lot

I am brand new to Silverstripe and have played with CMS.

I'm stuck at the moment ... I'm trying to add a $has_many relationship between a DataObject and images.

I find the documentation on how to make something like this pretty vague? I know that when you want to add a relationship between two DataObjects, you need to add the relations $many_many and $belongs_many_many , but how would you do this with images?

I tried adding images to $has_many and just using the upload field, but this only causes an error. I also tried saving the images in $has_one and increased the setAllowedMaxFileNumber loading setAllowedMaxFileNumber to 10, but this only saves 1 image.

Any help in this regard would be greatly appreciated :)

Thanks!

If anyone wants to see the code here, Pastebin

+5
source share
1 answer

You need a multi-valued image or have an intermediate object that facilitates the images .

This is because SilverStripe maintains model relationships.

+3
source

All Articles