【发布时间】:2020-01-14 14:46:55
【问题描述】:
我正在尝试设置我的产品创建页面并配置表单。 我有 2 个实体:Product 和 ProductTranslates
数据库:
product_id_id 上有一个外键(不知道为什么我有两个“id”...)
我想在我的 product.yaml 中使用一些 product_translates 字段(见下文)
例如,我想在我的表单中添加“描述”。 你知道我该怎么做吗?我可以轻松地使用“产品”属性,但不知道如何处理 yaml 文件中的 product_translate。
非常感谢!!!
easy_admin:
entities:
# the configuration of this entity is very verbose because it's used as
# an example to show all the configuration options available for entities
# check out the configuration of the other entities to see how concise
# can be the configuration of your backend
Product:
class: App\Entity\Product
label: 'Produits'
list:
...
form:
title: 'Créer un produit'
fields:
- { property: 'univers', label: 'univers' }
- { property: 'product_code', label: 'Référence', type: 'number' }
- { property: 'category_id', label: 'Catégorie', type: 'easyadmin_autocomplete', type_options: { class: 'App\Entity\Product' } }
- { property: 'is_cocktail', label: 'Est-ce un cocktail ?', type: 'checkbox' }
- { property: 'is_active', label: 'Voulez vous le publier ?', type: 'checkbox' }
- { property: 'alcohol_volume', label: 'Degré d''alcool', type: 'number' }
- { property: 'created_at', label: 'Date de création', type: 'datetime' }
- { property: 'photo', type: 'file', label: 'Uploader une photo', help: 'Sélectionner le fichier' }
edit:
...
【问题讨论】:
标签: symfony bundle symfony4 sf easyadmin