Use the entity
type for relations to other entities.
For example, suppose a Pet
entity has an owner
, a
manyToOne
doctrine relation to a User
entity.
You would use the entity
type on the owner
property to
give a pet an owner.
Collections of entities can be managed too - set the multiple
option to true
.
Note that sorting will not work out of the box. You’ll need to define a custom sort function if you want to sort by this field.
Included in the PerformBaseBundle.
The related entity class
This option is required.
Allowed types: string
Defaults:
The crud name to use for the related entity
This option is optional.
Allowed types: string
Defaults:
''
''
''
''
The property to use to display the related entity
This option is optional.
Allowed types: string
Defaults:
'id'
'id'
'id'
'id'
The label to use for form labels and table headings. If no label is provided, a sensible label will be created automatically.
This option is optional.
Allowed types: string
Defaults:
If true, display a link to view the related entity
This option is optional.
Allowed types: boolean
Defaults:
true
true
true
true
If true, assume the relation is a doctrine collection
This option is optional.
Allowed types: boolean
Defaults:
false
false
false
false
<?php
$config->add('owner', [
'type' => 'entity',
'options' => [
'class' => 'PerformUserBundle:User',
'display_field' => 'email',
],
'sort' => false,
]);