简体   繁体   中英

Symfony sonata admin bundle without entity

Is there the way to use sonata admin bundle without entity - so without doctrine?

I need to list files on some directory, this list is not stored in database.

The first approach I tried was to declare my own Model manager, but there are some places which require doctrine queries etc.

I know, that there is document manager for mongo and sonata mongo admin , but in my case it's not so helpful.

Any ideas?

In the documentation found here: http://sonata-project.org/bundles/admin/master/doc/reference/getting_started.html

It looks like in the create an admin section that #2 requires a model:

  1. The Admin service's code (defaults to the service's name)
  2. The model which this Admin class maps (required)
  3. The controller that will handle the administration actions (defaults to SonataAdminBundle:CRUDController)

The sample shows the service setup with manager_type as an ORM:

# Acme/DemoBundle/Resources/config/admin.yml
services:
    sonata.admin.post:
        class: Acme\DemoBundle\Admin\PostAdmin
        tags:
            - { name: sonata.admin, manager_type: orm, group: "Content", label: "Post" }
        arguments:
            - ~
            - Acme\DemoBundle\Entity\Post
            - ~
        calls:
            - [ setTranslationDomain, [AcmeDemoBundle]]

Now in general symfony doesn't set hard requirements on what a model is. It can be doctrine or something custom you build. In the case of services it is just an object. I don't see anywhere in the documentation says that you need a database.

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