Currenty we're developing a very flexible and modular application with Zend Framework 2 and Doctrine 2. In this application there are multiple Doctrine entities, for example let's say the entity Product in the module Products. This module Products is the base/default module for product management.
We want to be able to create a custom Products module for a customer (XProducts). Therefore I created a new entity, XProduct (with some extra fields) which extends Product.
So if the custom module is enabled I want to use XProduct and else Product, but never together (in the same project).
If I annotate both entities with @Entity it works partially; for example findAll works perfect, but find doesn't work: the created SELECT statement contains the correct columns, but the WHERE clause is wrong. For example:
SELECT t1.id AS id2, t1.name AS name3 FROM products t1 WHERE t0.id = ?
I guess t1 stands for ProductX and t0 for Product but I can't figure out why the columns are correct (t1) but the where clause isn't (t0).
I'm aware that Doctrine provides Single Table Inheritance to achieve inheritance, but therefore it's necessary to have a DiscriminatorColumn and to define the DiscriminatorMap at the base/default entity. This won't fit for us, because we need to change our base/default module if we add a new custom module for a customer (and that's not what we want...).
Does anyone have a clue on fixing this problem? Thanks!