Skip to content

Latest commit

 

History

History
executable file
·
188 lines (130 loc) · 7.71 KB

File metadata and controls

executable file
·
188 lines (130 loc) · 7.71 KB

0.13.* -> 0.14

This update contains a few possible breaking changes, many new deprecations added and some old deprecations removed.

Breaking changes

Personalization based on column priority, not order

Columns now contains priority - the higher priority, the earlier it will be rendered. This is opposite of previous "order" logic, where first item had "0" order, second "1", third "2", etc. If your application uses personalization persistence, make sure to clear its data, otherwise the order of the columns will be in reverse!

New column export views

The data table type classes now contain a new buildExportView() method.

The column type classes now contain new buildExportHeaderView and buildExportValueView methods.

These methods are meant to be especially lightweight, and used exclusively for exporting.

This is a breaking change if your application uses custom export-specific logic in any data table type buildView() method or any column type buildHeaderView() or buildValueView() methods!

Column, filter and exporter builders

Internally, the columns, filters and exporters are now utilizing the builder pattern similar to data tables and actions. If your application contains custom logic using internal bundle classes, you may need to update it.

New deprecations

Deprecated filter form-related options

The form-related filter type options are now deprecated:

  • field_type use form_type instead
  • field_options use form_options instead
  • operator_type use operator_form_type instead
  • operator_options use operator_form_options instead

To select a default operator for the filter, instead of overwriting the operator_options.choices option, use the new default_operator option.

To display operator selector to the user, instead of using the operator_options.visible option, use the new operator_selectable option.

To limit operator selection for the filter, instead of using the operator_option.choices option, use the new supported_operators option.

Deprecated built-in PhpSpreadsheet & OpenSpout integrations

The built-in integration with PhpSpreadsheet and OpenSpout is now deprecated.

The PhpSpreadsheet integration will not be officially supported (for now).

The OpenSpout integration is now extracted to a separate package - install kreyu/data-table-open-spout-bundle instead.

Deprecated builders name and options setter methods

The following builders now have setName, setOptions and setOption methods deprecated:

  • DataTableBuilderInterface
  • ColumnBuilderInterface
  • FilterBuilderInterface
  • ActionBuilderInterface
  • ExporterBuilderInterface

If you need to change default name of the data table type, override its getName() method:

use Kreyu\Bundle\DataTableBundle\Type\AbstractDataTableType;

class ProductDataTableType extends AbstractDataTableType
{
    public function getName(): string
    {
        return 'unique_products';
    }
}

If you need to change the name dynamically to display multiple data tables of the same type, use the factory createNamed() or createNamedBuilder() methods:

use Kreyu\Bundle\DataTableBundle\DataTableFactoryAwareTrait;

class ProductController
{
    use DataTableFactoryAwareTrait;
    
    public function index(): string
    {
        $availableProducts = $this->createNamedDataTable('available_products', ProductDataTableType::class);
        $unavailableProducts = $this->createNamedDataTable('unavailable_products', ProductDataTableType::class);
        
        // ...
    }
}

Same logic applies to every other feature (columns, filters, actions and exporters), although only data table factory is commonly used in the applications.

Deprecated default configuration extension

The Kreyu\Bundle\DataTableBundle\Extension\Core\DefaultConfigurationDataTableTypeExtension is now deprecated. The default configuration is now applied by the base Kreyu\Bundle\DataTableBundle\Type\DataTableType.

This extension is no longer registered in the container, however, if your application has it registered in the container (e.g. to change its priority), remove the definition.

Deprecated data table persistence subject options

The following data table type options are deprecated:

  • filtration_persistence_subject
  • sorting_persistence_subject
  • pagination_persistence_subject
  • personalization_persistence_subject

Instead, use the subject provider (that will provide a persistence subject) options:

  • filtration_persistence_subject_provider
  • sorting_persistence_subject_provider
  • pagination_persistence_subject_provider
  • personalization_persistence_subject_provider

Deprecated uppercase snake cased operator enum cases

The Kreyu\Bundle\DataTableBundle\Filter\Operator enum has changed its cases:

Before After
EQUALS Equals
CONTAINS Contains
NOT_CONTAINS NotContains
NOT_EQUALS NotEquals
GREATER_THAN GreaterThan
GREATER_THAN_EQUALS GreaterThanEquals
LESS_THAN_EQUALS LessThanEquals
LESS_THAN LessThan
START_WITH StartsWith
END_WITH EndsWith

Replace all occurrences of the old cases with the new ones.

Note: the previous cases are marked as deprecated, and internally are converted to the new ones using the getNonDeprecatedCase() method to ease the transition process.

Additionally, the translation keys of operator cases have changed:

Operator Translation key before Translation key after
Equal EQUALS Equals
Contain CONTAINS Contains
NotContain NOT_CONTAINS Not contains
NotEqual NOT_EQUALS Not equals
GreaterThan GREATER_THAN Greater than
GreaterThanEqual GREATER_THAN_EQUALS Greater than or equals
LessThanEqual LESS_THAN_EQUALS Less than or equals
LessThan LESS_THAN Less than
StartWith STARTS_WITH Starts with
EndWith ENDS_WITH Ends with

The translation change ensures that applications without translator component can use the translation key as fallback.

Deprecated uppercase snake cased export strategy enum cases

The Kreyu\Bundle\DataTableBundle\Exporter\ExportStrategy enum has changed its cases:

Before After
INCLUDE_ALL IncludeAll
INCLUDE_CURRENT_PAGE IncludeCurrentPage

Replace all occurrences of the old cases with the new ones.

Note: the previous cases are marked as deprecated, and internally are converted to the new ones using the getNonDeprecatedCase() method to ease the transition process.

Additionally, the translation keys of operator cases have changed:

Strategy Translation key before Translation key after
IncludeAll INCLUDE_ALL Include all
IncludeCurrentPage INCLUDE_CURRENT_PAGE Include current page

The translation change ensures that applications without translator component can use the translation key as fallback.