I'm quite new to Silverstripe and have been playing around with the CMS.
At the moment I'm stuck... I'm trying to add a $has_many
relationship between a DataObject and Images.
I'm finding the documentation on doing something like this quite vague? I know that when you want to add a relationship between two DataObjects you need to add a $many_many
and $belongs_many_many
relationship but how would I do this with images?
I tried adding images to a $has_many
and simply using an upload field but this only causes an error. I also tried keeping the images in $has_one
and increasing the upload field setAllowedMaxFileNumber
to 10 but this only saves 1 image.
Any help in this regard would greatly be appreciated :)
Thanks!
Incase anyone wants to see the code here is a Pastebin
You need to many_many image, or have an intermediary object that facilitates images.
This is due to the way that SilverStripe stores a models relationships.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With