Depending on the complexity and the customization of your backend, you can use different configuration formats.
This is the simplest configuration and is best used to create a prototype in a few seconds. Just list the classes of the entities to manage in the backend:
easy_admin:
entities:
- AppBundle\Entity\Customer
- AppBundle\Entity\Product
This configuration format allows to set the labels displayed in the main menu of the backend. Just list the entities but use a text-based key for each entity:
easy_admin:
entities:
Customer: AppBundle\Entity\Customer
Inventory: AppBundle\Entity\Product
This configuration format allows to control which fields, and in which order,
are shown in the listings and in the forms. Just use the list
, edit
and
new
options and define the fields to display in the fields
option:
easy_admin:
entities:
Customer:
class: AppBundle\Entity\Customer
list:
fields: ['id', 'name', 'email']
Inventory:
class: AppBundle\Entity\Product
list:
fields: ['id', 'code', 'description', 'price']
edit:
fields: ['code', 'description', 'price', 'category']
new:
fields: ['code', 'description', 'price', 'category']
If the edit
and new
configuration is the same, use instead the special
form
option, which will be applied to both of them:
easy_admin:
entities:
Customer:
class: AppBundle\Entity\Customer
list:
fields: ['id', 'name', 'email']
Inventory:
class: AppBundle\Entity\Product
list:
fields: ['id', 'code', 'description', 'price']
form:
fields: ['code', 'description', 'price', 'category']
This is the most advanced configuration format and it allows you to control the type, style, help message and label displayed for each field. Customize any field just by replacing its name with a hash with its properties:
easy_admin:
entities:
Customer:
class: AppBundle\Entity\Customer
list:
fields: ['id', 'name', { property: 'email', label: 'Contact Info' }]
Inventory:
class: AppBundle\Entity\Product
list:
fields: ['id', 'code', 'description', 'price']
form:
fields:
- { property: 'code', help: 'Alphanumeric characters only' }
- { property: 'description', type: 'textarea' }
- { property: 'price', type: 'number', class: 'input-lg' }
- { property: 'category', label: 'Commercial Category' }
The previous configuration formats can also be combined. This is useful to use the default configuration when it's convenient and to customize it when needed:
easy_admin:
entities:
Customer: AppBundle\Entity\Customer
Inventory:
class: AppBundle\Entity\Product
list:
fields: ['id', 'code', 'description', 'price']
form:
fields:
- { property: 'code', help: 'Alphanumeric characters only' }
- { property: 'description', type: 'textarea' }
- { property: 'price', type: 'number', class: 'input-lg' }
- { property: 'category', label: 'Commercial Category' }