Reputation: 94
I'm trying to find out how I can have the edit action of a Document (Entity) that is using an array of Object IDs to store the ID of an image stored using GridFS. This is a one-to-many but using an array inside the Document, instead of a middle table.
So far I was able to add the following to my edit action:
Here is the code I've used in the NewsAdmin configureFormFields():
$formMapper
->with('Images Manager')
->add(
'cover_images',
CollectionType::class,
['required' => true, 'label' => 'Cover Images'],
[ 'admin_code' => 'admin.file' ]
)
I have a controller and an action (@Route("/image/{id}", name="show_image")) that handles the display of images in the frontend using MongoDB GridFS. It uses the IDs stored in this array:
Upvotes: 1
Views: 75