Skip to content

Instantly share code, notes, and snippets.

@nenad-mitic-bg
Created August 3, 2019 09:35
Show Gist options
  • Save nenad-mitic-bg/7d0dc5fbf0551ed1e0e484837e88214f to your computer and use it in GitHub Desktop.
Save nenad-mitic-bg/7d0dc5fbf0551ed1e0e484837e88214f to your computer and use it in GitHub Desktop.
For Medium article "Symfony EasyAdmin: complex forms" - example that works
easy_admin:
entities:
Purchase:
class: App\Entity\Purchase
controller: App\Controller\Admin\PurchaseController
disabled_actions: ['delete']
list:
actions: [ { name: 'show', icon: 'shopping-basket' } ]
fields: ['guid', 'buyer', 'deliveryDate', 'deliveryHour', 'billingAddress', 'purchasedItems', 'total']
form:
fields:
- { type: 'group', label: 'Delivery Details', icon: 'truck', css_class: 'col-sm-4' }
- deliveryDate
- deliveryHour
- { type: 'divider' }
-
property: billingAddress
type: App\Form\StreetAddressType
- { type: 'group', label: 'Purchase Details', icon: 'shopping-cart', css_class: 'col-sm-4' }
- { property: 'guid', type_options: { 'disabled': true } }
- { property: 'buyer', type: 'easyadmin_autocomplete' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment