简体   繁体   中英

Easyadmin bundle of Symfony

I am creating backend using Symfony. I want to create submenu. I am writing following code in easy_admin file inside config/packages:

easy_admin:
    design:
        menu:
            - label: 'Products'
              icon: 'shopping-basket'
              children:
                  - { entity: 'Product', icon: 'th-list', label: 'List Products' }
                  - { entity: 'Product', label: 'Add Product' }
                  - { label: 'Additional Items' }
                  - { entity: 'User', label: 'Users' }

I have created entities of Product and User located in src/Entity

But I am getting error:

The "Product" entity included in the "menu" option is not managed by EasyAdmin. The menu can only include any of these entities: .

What I am doing wrong? Thank you in advance!

To solve your problem you need at first read carefully the documentation on easyadmin . Then you find there that you need to add your entities to easyadmin config file, smth like this:

# config/packages/easy_admin.yaml
easy_admin:
# ...
    entities:
        - App\Entity\Product
        - App\Entity\User

or

# config/packages/easy_admin.yaml
easy_admin:
# ...
    entities:
        Product:
            class: App\Entity\Product
        User:
            class: App\Entity\User

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM