We are currently developing a very flexible and modular application with Zend Framework 2 and Doctrine 2. There are several Doctrine objects in this application, for example, let the Product object in the Products module say. This Products module is the basic / standard module for product management.
We want to create a custom Products module for the client ( XProducts ). Therefore, I created a new XProduct object (with some additional fields) that extends Product .
So, if the user module is enabled, I want to use XProduct and Product , but never together (in the same project).
If I annotate both objects with @Entity, it works partially; for example, findAll works fine, but find does not work: the generated SELECT statement contains the correct columns, but the WHERE clause is incorrect. For instance:
SELECT t1.id AS id2, t1.name AS name3 FROM products t1 WHERE t0.id = ?
I think t1 means ProductX and t0 for Product , but I cannot understand why the columns are correct ( t1 ), but the where clause is not ( t0 ).
I know that Doctrine provides one-page inheritance to achieve inheritance, but so you need to have a DiscriminatorColumn and define a DiscriminatorMap in the database / default. This is not suitable for us, because we need to change our base / default module if we add a new user module for the client (and this is not what we want ...).
Does anyone have a clue to fix this problem? Thanks!
source share