fsv/sortable-collection-type-bundle

此包已被废弃,不再维护。未建议任何替代包。

Symfony可排序集合表单类型

0.1.1 2017-02-14 14:15 UTC

This package is not auto-updated.

Last update: 2022-10-15 08:40:54 UTC


README

Build Status

该扩展用于对FormView对象进行排序。排序基于指定的属性值。属性由Symfony PropertyAccess组件中的属性路径确定。

安装

$ composer require fsv/sortable-collection-type-bundle
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Fsv\SortableCollectionTypeBundle\FsvSortableCollectionTypeBundle(),
    );
}

配置

该扩展没有可配置的参数。

用法

// AppBundle\Form\Type\ExampleFormType.php

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder->add('collection', CollectionType::class, [
        // ...
        'sort_by' => [
            'property' => 'asc'
        ]
    ]);
    // ...
}