l3pp4rd/DoctrineExtensions — Issue #166: [Translatable] Entity using inheritance
Author: armetiz
Created: 2011-10-11 12:09:50+00:00
State: open

Example :
EntityA implement Translatable. EntityB extend EntityA.

EntityA define a "locale" property and also a setTranslatableLocale function.
When using EntityB & Translatable, the problem is that "locale isn't define on EntityB".

The error is throw by ReflectionClass on TranslationListener line 250 with :
- $reflectionProperty = $class->getProperty($this->configurations[$meta->name]['locale']);

TranslationListener check if the object define a locale property using Reflection.
The problem is that TranslationListener know only EntityB, and do reflection on EntityB cannot be able to find the "locale "property.

Right now, I define the locale property both on EntityA & EntityB.. It work but this is really insane.

The other solution is to use the interface Translatable to check if locale is correctly define.
The interface Translatable should define setLocale & getLocale.
To keep the actual feature, you can check if the object is instance of Translatable, and if not check if the property locale exists using Reflection.

Thomas.