lundi 29 décembre 2014

Pros and cons of a global base object for all objects in Doctrine2

What are the pros and cons of using a global base entity for all entities in my Doctrine2 model?


I am considering having all of my domain entities extend a single generic base entity, so that I can specify the target entity of an association to be the base entity class, thereby allowing that association to hold any entity in my domain.


My associations will still be as specific as possible: an Order entity will contain Product objects, not Base objects. But more 'meta'-like functionality like status log items, authorization specs, etc., can be specified very generically by defining LogItems and AuthorizationRules having an association to BaseEntity, instead of with specific items.


I am not seeing this approach anywhere, but there seems to be some use or power to having all classes extend off a base Object entity ('Java-style'). But perhaps I am needlessly overcomplicating things.


Is a base entity in Doctrine2 a good idea?


Aucun commentaire:

Enregistrer un commentaire