caxy/easy-sonata-admin

简化配置系统的 Sonata Admin。

安装: 67

依赖: 0

建议者: 0

安全性: 0

星标: 0

关注者: 5

分支: 0

开放问题: 0

类型:symfony-bundle

1.0 2016-05-12 18:54 UTC

This package is not auto-updated.

Last update: 2024-09-10 22:07:50 UTC


README

###入门指南

  1. 将 EasySonataAdminBundle 添加到您的项目中
composer require caxy/easy-sonata-admin
  1. 启用组件
// app/AppKernal.php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(

            //Load before SonataAdminBundle!
            new Caxy\EasySonataAdminBundle\EasySonataAdminBundle(),

            new Sonata\AdminBundle\SonataAdminBundle(),
        );
    }
}
  1. 配置您的管理器。以下为 FOS 用户实体的示例
// app/config/config.yml

easy_sonata_admin:
    entities:
        User:
            class: AppBundle\Entity\User
            batch_actions:
                - '-delete'
            list:
                fields:
                    - id
                    - username
                    - email
                    - enabled
                actions: [show: {}, 'edit', 'delete']
            edit:
                fields:
                    - { property: id, type_options: { } }
                    - { property: username, type_options: { } }
                    - { property: email, type_options: { } }
                    - { property: enabled, type_options: { } }
                    - { property: 'plain_password', type: 'text', type_options: { required: true } }
                actions: ['-delete']
            filter:
                fields:
                    - username
                    - email
                    - enabled
                    - roles
            show:
                fields:
                    - username
                    - email
                    - enabled
                    - { property: 'last_login', type: 'datetime' }
                    - roles
                actions: ['-delete']