I have 2 Abstract classes: AbstractCommentable (methods for comments) and AbstractImaging (entity methods for manage images).
Some classes already have:
class Trip extends AbstractImaging {/** some stuff **/}
class Marker extends AbstractImaging {/** some stuff **/}
class Gastronomy extends AbstractImaging {/** some stuff **/}
But I want to add AbstractCommentable to this classes...
What's the right way to do that?
You either have to make AbstractImaging
already extend AbstractCommentable
or other way around ... which i suggest you don't want.
Multiple inheritance can only be linear in PHP because of possible conflicts.
You can't do something like ...
class Whatever extends AbstractImaging, AbstractCommentable
The easy way:
If you're using php 5.4+ you could use a trait to add the CommentableInterface methods to your entity.
The complicated way:
create an annotation and let a doctrine-listener create a proxy class adding the commentable methods.