I'm kind of new with Symfony, and I have a question. I'm currently making a Gallery Bundle (consisting of 'Gallery' and 'Image' entities), and here comes my problem.
I can upload images as well as use my entity Image corresponding to the file, but then I'd like to categorize my images into galleries. I made a One-To-Many relationship between my Gallery and Image entities, with an ArrayCollection $images (into Gallery Entity) that should represents the images.
Now, how can I populate that $images variable from a browser ? I thought of that solution : add a text field into the Gallery entity, with the images names, and before persisting the Gallery entity, I would fetch the corresponding Images entities and put them into my variable $images, but the problem is that I can't access the entity manager from an entity..
Thanks for the help, if you need code I can of course show you, even if it's pretty basic.
EDIT: I found a way to get access to the entity manager from an entity, but it is said to be unsecure. For the time being I'll probably use that, but if someone can explain to me a better way, I'll take it.