caxy / easy-sonata-admin
简化配置系统的 Sonata Admin。
1.0
2016-05-12 18:54 UTC
Requires
- sonata-project/admin-bundle: 2.3.*
This package is not auto-updated.
Last update: 2024-09-10 22:07:50 UTC
README
###入门指南
- 将 EasySonataAdminBundle 添加到您的项目中
composer require caxy/easy-sonata-admin
- 启用组件
// app/AppKernal.php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
//Load before SonataAdminBundle!
new Caxy\EasySonataAdminBundle\EasySonataAdminBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
);
}
}
- 配置您的管理器。以下为 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']