a2lix / TranslationFormBundle

Ease translations with some dedicated Symfony form types
https://a2lix.fr/bundles/translation-form
MIT License
330 stars 138 forks source link

Symfony5 EasyAdmin3 and KNP Behavior problem #353

Closed e1sep0 closed 4 years ago

e1sep0 commented 4 years ago

Hello, i have problem with Symfony 5, EasyAdmin 3, KNP Translatable and A2lix form:

I made new Field in EasyAdmin:

final class TranslationField implements FieldInterface
{
    use FieldTrait;

    public static function new(string $propertyName, ?string $label = null): self
    {
        return (new self())
            ->setProperty($propertyName)
            ->setLabel($label)
            ->setFormType(TranslationsType::class)
            ->setFormTypeOptions(
                [
                    'default_locale' => '%locale%',
                ]
            );
    }
}

And use it in CrudController:

public function configureFields(string $pageName): iterable
    {
        return [
            TranslationField::new('translations')->hideOnIndex(),
            TextField::new('title')->hideOnForm(),
            IntegerField::new('value'),
        ];
    }

And got new error from A2lix: Argument 1 passed to A2lix\AutoFormBundle\ObjectInfo\DoctrineORMInfo::__construct() must be an instance of Doctrine\Common\Persistence\Mapping\ClassMetadataFactory, instance of Doctrine\ORM\Mapping\ClassMetadataFactory given, called in /var/www/kr/sova-grade-form/var/cache/dev/ContainerSd2qxYP/getA2lixAutoForm_Form_Manipulator_DoctrineOrmManipulatorService.php on line 24 I removed parameter type in __construct and method getAssocsConfig for test, and it works. How can i fix it without changing a2lix bundle?) Thank you

ondrapixman commented 4 years ago

Have a same issue when you change use from Doctrine\Common\Persistence\Mapping\ClassMetadataFactory to Doctrine\ORM\Mapping\ClassMetadataFactory it works need fix :(

webda2l commented 4 years ago

Hello, Latest version of https://github.com/a2lix/AutoFormBundle/releases/tag/0.3.2 should fix the problem.