Jira issue originally created by user harmenm:
The Doctrine ProxyGenerator generates for a proxy a constructor. The documentation of Doctrine states that the constructor is never called. For a project, I created a group of entities with a interfaced constructor in order to enforce a common interface. This results in a incompatible proxy and so a fatal error.
Comment created by @ocramius:
Cannot fix this - the constructor is required to override instantiation logic
Comment created by harmenm:
Edit: added the correct description. I accidentially submitted the form before editing the description.
[~harmenm] why do you have a constructor in an interface? That's a very bad practice, and it makes things quite hard to handle.
I can think of a workaround, but I first want to be sure there's a real advantage in changing the current implementation to use unserialize() just to handle this specific use case.
Comment created by @beberlei:
Adding **construct to an interface is an anti pattern and shouldn't be done.
Ok, then I change my implementation.
But, maybe it is an idea to update the documentation of the ORM and state that constructor interfacing is not possible?
I actually had more requests for this feature on a similar project ( Ocramius/ProxyManager#115 ).
I will mark this as feature request, but can't guarantee that it will get into Doctrine 2.x, since it may be a BC break.
Comment created by @guilhermeblanco:
Creating interfaces with **construct ties your contract preventing extensibility points. This is nature of OOP and I do not consider this should be documented because it's (in-theory) expected that people have some level of knowledge in OO design when coding.
Closing this as invalid.
While interfaced constructors are a known bad practice, changing constructor parameters is also a well known LSP violation (a minor one).
I'll keep tracking this, but I'm blocked by HHVM's missing Closure::bind() as of facebook/hhvm#1203
Note: won't be solved in 2.5.0.
As a side-note, this was solved in ProxyManager meanwhile, but we can consider this change only for 3.0.x