I have an entity which defines inheritance like this:
* @DiscriminatorColumn(name="type", type="string")
* @DiscriminatorMap({"text" = "TextAttribute", "boolean" = "BooleanAttribute", "numeric" = "NumericAttribute", "date" = "DateAttribute"})
I am wondering is it possible to have getter for field 'type'? I know I can use instanceof (and in most cases this is what I'm doing) but there are few scenarios where $item->getType() would make my life so much easier.
There's a slicker way to do it in PHP 5.3:
My approach is to simply access it's value through the meta data doctrine generates
will give you the value, so as a method
I cache the metadata in a static variable for each class that extends my base entity, there is a lot of other useful information in there as well ...