aschaeffer/sonata-editable-list-bundle
Composer 安装命令:
composer require aschaeffer/sonata-editable-list-bundle
包简介
Symfony SonataClassificationBundle
README 文档
README
Sonata Editalbe List Bundle allow you to define editable list for entities.
Installation
Install the package with:
composer require aschaeffer/sonata-editable-list-bundle
If you're not using Symfony Flex, you'll also need to enable the Aschaeffer\SonataEditableListBundle\AschaefferSonataEditableListBundle in your AppKernel.php file.
You can then add SonataEditableList and SonataEditableItem in App\Entity. The class can be found in the recipe branch of this repository.
Also, add the following configuration:
#config/packages/aschaeffer_sonata_editable_list.yaml aschaeffer_sonata_editable_list: class: list: App\Entity\SonataEditableList item: App\Entity\SonataEditableItem
Usage
In your entity, add Listable annotation to use editable list :
<?php class User { /** * @Listable(code="user_gender") * @ORM\ManyToOne( * targetEntity="SonataEditableItem", cascade={"persist"} * ) * @ORM\JoinColumn(name="gender_id", referencedColumnName="id") * * @var SonataEditableItem */ protected $gender; /** * @var SonataEditableItem[] $interests * @ORM\ManyToMany(targetEntity="SonataEditableItem") * @ORM\JoinTable(name="users_interests", * joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="item_id", referencedColumnName="id")} * ) * @Listable(code="user_interests") */ protected $interests; }
Create user_gender and user_interests list in Sonata admin or use the sonata:editable_list:create command to initialze lists and define all the possible values.
In your Sonata admin class, listable property will property in ShowMapper and ListMapper. When using these properties in FormMapper and DatagridMapper, you will need to add the following code :
use Aschaeffer\SonataEditableListBundle\Form\Type\ItemSelectorType; class UserAdmin { protected function configureFormFieldsProperties(FormMapper $formMapper) { $formMapper ->add('gender', ItemSelectorType::class, [ 'model_manager' => $this->getModelManager(), 'class' => SonataEditableItem::class, 'required' => true, 'expanded' => true, 'multiple' => false, ] ) ->add('interests', ItemSelectorType::class, [ 'model_manager' => $this->getModelManager(), 'class' => SonataEditableItem::class, 'required' => true, 'expanded' => true, 'multiple' => true, ] ) } protected function configureDatagridFilters(DatagridMapper $datagridMapper) { $datagrid ->add('gender', null, [], ItemSelectorType::class, [ 'model_manager' => $this->getModelManager(), 'class' => SonataEditableItem::class, 'multiple' => true, 'field_name' => 'gender', 'class_name' => User::class, ] ) ->add('gender', null, [], ItemSelectorType::class, [ 'model_manager' => $this->getModelManager(), 'class' => SonataEditableItem::class, 'multiple' => true, 'field_name' => 'interests', 'class_name' => User::class, ] ) } }
aschaeffer/sonata-editable-list-bundle 适用场景与选型建议
aschaeffer/sonata-editable-list-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 140 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 02 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sonata」 「list」 「editable」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 aschaeffer/sonata-editable-list-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aschaeffer/sonata-editable-list-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 aschaeffer/sonata-editable-list-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Sonata Extra admin features
Easily provide front-end sorting controls for SilverStripe lists
ACL list filtering for SonataAdmin
A block to display a list of links to child pages, or pages in current level
Content inline editable package.
Adjacency List’ed Closure Table database design pattern implementation for Laravel. Includes restore of tree
统计信息
- 总下载量: 140
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-02-25