我需要实现的目标是:我有两个以一对多方式相关的实体:优惠和产品,当用户想要创建优惠时,他们还必须选择产品。该部分已完成,现在用户希望我添加另一个字段(与Product有一对多关系的Product Categories),它应该是一个select字段,以便过滤表单中的产品。
我怎么能实现这个目标?我正在使用Doctrine。
编辑:
这是我的.orm.yml文件
Dayscript \ AdminBundle \实体\ Promocion:
type: entity
table: promocion
indexes:
id_producto_regalo:
columns:
- id_producto_regalo
id:
id:
type: integer
nullable: false
unsigned: false
comment: ''
id: true
generator:
strategy: IDENTITY
fields:
nombre:
type: string
nullable: false
length: 50
fixed: false
comment: ''
descripcion:
type: text
nullable: false
length: null
fixed: false
comment: ''
tipo:
type: string
nullable: false
length: 15
fixed: false
comment: ''
valor:
type: float
nullable: true
precision: 10
scale: 0
comment: ''
codigo:
type: string
nullable: false
length: 50
fixed: false
comment: ''
url_imagen:
type: text
nullable: false
length: null
fixed: false
comment: ''
manyToOne:
idProductoRegalo:
targetEntity: Producto
cascade: { }
mappedBy: null
inversedBy: null
joinColumns:
id_producto_regalo:
referencedColumnName: id
orphanRemoval: false
lifecycleCallbacks: { }
这是一个截图: http://imgur.com/DdEZnD4
我们的想法是,在选择产品之前,应该有另一个下拉列表,以便此人可以在选择产品之前按类别过滤产品。