We’ve all been confronted to that problem : “Entity must be managed” when we are trying to setFilters() / getFilters()
So how to handle the session storage of filters in a generic way, in order to avoid merging and detaching or re-hydrating manually the entities ?
See the answer just below.
Well, some colleague (@benji07) at work have written this :
It works for basic entities, and multivalued choices
PS: Don’t forget to add a use statement for the
ArrayCollectionDisclaimer, we don’t know if it’s a good practice, and we know at least one limitation : you have to be sure that the object you try to save in the session has an
id(it’s 99,9% the case)