Link an asset folder to a model

Silverstripe Version: 4

Question:

I want to make a different gallery for each model object I create.

I have done this with a $has_many but it is proving cumbersome

the structure:

ParentModel (DataObject)
--------- has_many GalleryImage::class
---------------has_many Image::class

What i would rather do is just pick a folder that all the images is in and then loop the children of that folder in the template displaying each image.

Can that be done?

// Include any relevant code. If you have a lot of code, link to a gist instead.

Yes. You could set a has_one to Folder::class and then use perhaps a tree dropdown field to select the folder.