Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0-ALPHA3
-
Fix Version/s: None
-
Component/s: None
-
Security Level: All
-
Labels:None
Description
I've tried several different methods to be able to achieve this without any success. I want to be able to map to objects that don't necessarily contain database properties.
Example:
/*
* @Entity
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="type", type="string")
* @DiscriminatorMap({"Static"="StaticBlock", "Test"="Test"})
*/
abstract class Block
{
/**
* @Id @Column(name="id", type="integer")
* @GeneratedValue(strategy="AUTO")
*/
protected $id;
//...
/*
* @Entity
*/
abstract class DynamicBlock extends Block
{
//... No doctrine properties
}
/*
* @Entity
*/
class Test extends DynamicBlock
{
//... No doctrine properties
}
In this example using JOINED as the InheritanceType, createSchema will execute without error but when I try to load a model of type Test, it says "Base table or view not found: 1146 Table 'db.test' doesn't exist".
If I try this with a SINGLE_TABLE InheritanceType on Block, I get "The table with name 'block' already exists." when executing createSchema (I assume because it sees Block twice as an entity super class).
We should be able to have classes that don't have any database properties inherit from classes that do without creating empty tables in the database.
Is there a way to do this?