EasyAdmin 3 翻译错误,"translations"字段的Doctrine类型为“4”,EasyAdmin暂不支持
EasyAdmin 3 Translation Error, The Doctrine type of the "translations" field is "4", which is not supported by EasyAdmin yet
我正在使用 symfony 5.2 和 Easyadmin 3。当时我尝试在 easyadmin 中使用 A2Lix 包实现翻译,但出现如下错误:
The Doctrine type of the "translations" field is "4", which is not
supported by EasyAdmin yet.
我已经与 Symfony EasyAdmin 3.x ManyToMany error when adding : The Doctrine type of the .... field is "4", which is not supported by EasyAdmin yet
确认过
但这种情况不同,因为我在 easyadmin 中实现翻译。
谁能帮帮我?如何解决。
终于找到解决这个问题的方法了。
我从下面找到了解决方案 link:
创建了一个翻译字段:
namespace App\Admin\Field;
use A2lix\TranslationFormBundle\Form\Type\TranslationsType;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait;
final class TranslationField implements FieldInterface
{
use FieldTrait;
public static function new(string $propertyName, ?string $label = null, $fieldsConfig = []): self
{
return (new self())
->setProperty($propertyName)
->setLabel($label)
->setFormType(TranslationsType::class)
->setFormTypeOptions(
[
'default_locale' => '%locale%',
'fields' => $fieldsConfig,
]
);
}
}
在 CRUD 控制器中创建田间工具后:
public function configureFields(string $pageName): iterable
{
$fieldsConfig = [
'subject' => [
'field_type' => TextareaType::class,
'required' => true,
'label' => 'Тема',
],
'text' => [
'field_type' => CKEditorType::class,
'required' => true,
'label' => 'Текст',
],
];
return [
TranslationField::new('translations', 'Переводы', $fieldsConfig)
->setRequired(true)
->hideOnIndex(),
TextField::new('subject')->hideOnForm()->setLabel('Тема'),
BooleanField::new('isActive')->setLabel('Активность'),
];
}
此代码将为面临此类问题的任何人节省时间。
我正在使用 symfony 5.2 和 Easyadmin 3。当时我尝试在 easyadmin 中使用 A2Lix 包实现翻译,但出现如下错误:
The Doctrine type of the "translations" field is "4", which is not supported by EasyAdmin yet.
我已经与 Symfony EasyAdmin 3.x ManyToMany error when adding : The Doctrine type of the .... field is "4", which is not supported by EasyAdmin yet
确认过但这种情况不同,因为我在 easyadmin 中实现翻译。
谁能帮帮我?如何解决。
终于找到解决这个问题的方法了。
我从下面找到了解决方案 link:
创建了一个翻译字段:
namespace App\Admin\Field;
use A2lix\TranslationFormBundle\Form\Type\TranslationsType;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait;
final class TranslationField implements FieldInterface
{
use FieldTrait;
public static function new(string $propertyName, ?string $label = null, $fieldsConfig = []): self
{
return (new self())
->setProperty($propertyName)
->setLabel($label)
->setFormType(TranslationsType::class)
->setFormTypeOptions(
[
'default_locale' => '%locale%',
'fields' => $fieldsConfig,
]
);
}
}
在 CRUD 控制器中创建田间工具后:
public function configureFields(string $pageName): iterable
{
$fieldsConfig = [
'subject' => [
'field_type' => TextareaType::class,
'required' => true,
'label' => 'Тема',
],
'text' => [
'field_type' => CKEditorType::class,
'required' => true,
'label' => 'Текст',
],
];
return [
TranslationField::new('translations', 'Переводы', $fieldsConfig)
->setRequired(true)
->hideOnIndex(),
TextField::new('subject')->hideOnForm()->setLabel('Тема'),
BooleanField::new('isActive')->setLabel('Активность'),
];
}
此代码将为面临此类问题的任何人节省时间。