Hi All, I'm trying to implement a simple way to filter an association by "enabled" entities, but can't seem to figure it out.
As an example, I have a *product*, which has an association to *supplier* which can be enabled or disabled (basically a soft delete). By default I only want to get enabled *suppliers*. Basically, it'd be nice if it was possible to define an association on an entity that had a filter condition. Eg. *product.suppliers*: "enabled=1". I know I can use the Repository and always retrieve the enabled *suppliers* from it with DQL, but if I want to join *product* against any other entity, and access the *suppliers* I run into the problem. An alternative is to use Criteria and add to *product* an *getActiveSuppliers* method. Again, it's only useful after *product* hydration whether by DQL or Repository. I thought of trying table inheritance, but wouldn't that split enabled/disabled into 2 different entities? Seems a bit fudgy to delete an "enabled" entity and create a new "disabled" entity just to make it disabled. I'm leaning towards Criteria at the moment, but it'd be nice if there was some way of defining a join with conditions in the *product*. Hopefully someone can give me a point in the right direction, would be much appreciated! Cheers, Cameron -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
