我有两个表,Clientes
它们Servicios
有关系,我希望教义只返回客户端及其服务,而不是使用 addAction 表单时存在的所有服务,例如:
`Client: Foo
Services:
Bar
Bar2
Bar3
Client: Foo2
Services:
Bar2
Bar7
Client: Foo3
Services:
Bar`
我不知道如何告诉 Symfony2 或 Doctrineclient Foo
分配了 X 服务......
这是学说 yml
Pge\IncidenciasBundle\Entity\Clientes:
type: entity
table: clientes
id:
id:
type: integer
unsigned: false
nullable: false
generator:
strategy: IDENTITY
fields:
nombre:
type: string
length: 250
fixed: false
nullable: true
manyToOne:
servicio:
targetEntity: Servicios
cascade: { }
mappedBy: null
inversedBy: cliente
joinColumns:
servicio_id:
referencedColumnName: id
orphanRemoval: false
oneToMany:
incidencia:
targetEntity: Incidencias
cascade: { }
mappedBy: cliente
inversedBy: null
orphanRemoval: false
lifecycleCallbacks: { }
Pge\IncidenciasBundle\Entity\Servicios:
type: entity
table: servicios
id:
id:
type: integer
unsigned: false
nullable: false
generator:
strategy: IDENTITY
fields:
nombre:
type: string
length: 250
fixed: false
nullable: true
oneToMany:
cliente:
targetEntity: Clientes
cascade: { }
mappedBy: servicio
inversedBy: null
orphanRemoval: false
incidencia:
targetEntity: Incidencias
cascade: { }
mappedBy: servicio
inversedBy: null
orphanRemoval: false
lifecycleCallbacks: { }