I have an entity which defines inheritance like this:
* @DiscriminatorColumn(name=\"type\", type=\"string\")
* @DiscriminatorMap({\"text\" = \"TextAttribute\
There's a slicker way to do it in PHP 5.3:
abstract Parent
{
const TYPE = 'Parent';
public static function get_type()
{
$c = get_called_class();
return $c::TYPE;
}
}
class Child_1 extends Parent
{
const TYPE = 'Child Type #1';
//..whatever
}
class Child_2 extends Parent
{
const TYPE = 'Child Type #2';
//...whatever
}