简体   繁体   English

没有实体的Symfony奏鸣曲管理员捆绑

[英]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. 我知道,有mongosonata mongo管理员的 文档 管理员 ,但在我的情况下,它没有那么有用。

Any ideas? 有任何想法吗?

In the documentation found here: http://sonata-project.org/bundles/admin/master/doc/reference/getting_started.html 在此处的文档中: 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: 看起来在创建一个管理部分,#2需要一个模型:

  1. The Admin service's code (defaults to the service's name) Admin服务的代码(默认为服务名称)
  2. The model which this Admin class maps (required) 此Admin类映射的模型(必需)
  3. The controller that will handle the administration actions (defaults to SonataAdminBundle:CRUDController) 将处理管理操作的控制器(默认为SonataAdminBundle:CRUDController)

The sample shows the service setup with manager_type as an ORM: 该示例显示了使用manager_type作为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. 现在一般来说,symfony没有对模型的要求设置硬性要求。 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. 我没有看到文档中的任何地方说你需要一个数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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