Symfony use setter for Arraycollection in CreateController
问题 I'd like to create an upload form for documents. It's possible to select several so called 'agencies' and each of these agencies belongs to one specific market. What I want to do is, set the markets automatically. So in my controller I had something like this: $document->setMarket($document->getAgencies()->getMarket()); But since the agencies are an ArrayCollection, I can't call a getter on them. So I was thinking about a for each loop in order to get the markets for every single agency.