Closed alchy58 closed 1 month ago
I ran into the same issue 👍
Your solution works in the Basic case, but the a2lix allows you to change the Translation class name. This method can be overridden in the Translatable Entity.
public static function getTranslationEntityClass(): string{
return static::class . 'Translation';
}
Have you found a workaround or fix?
*Edit:
return $dataClass::getTranslationEntityClass();
Would do it for all cases i think.
Hello,
I have an entity Person which inherits a Thing entity, based on schema.org pattern. I also have a PersonTranslation which inherits a ThingTranslation entity.
ThingTranslation entity declares the
description
attribute. Person entityTranslation declares thejobTitle
attribute.Then, on the PersonType form type, using
->add('translations', TranslationsType::class
works fine.The issue is when I want to describe both fields. I get the error
Field(s) 'jobTitle' doesn't exist in App\Thing\Entity\ThingTranslation
.In
A2lix\AutoFormBundle\Form\Manipulato\DoctrineORMManipulator@getDataClass
, the association mapping fails to detect the PersonTranslation class.If I basically replace https://github.com/a2lix/AutoFormBundle/blob/ff1c9f3d1bee6143b0376e07a0770c11aea2bc5b/src/Form/Manipulator/DoctrineORMManipulator.php#L88 by
return $dataClass.'Translation';
, it works.Do you think it can have drawbacks ?
I may be related to https://github.com/a2lix/AutoFormBundle/issues/17
Thank you a lot.