This update contains a few possible breaking changes, many new deprecations added and some old deprecations removed.
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!
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!
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.
The form-related filter type options are now deprecated:
field_type
useform_type
insteadfield_options
useform_options
insteadoperator_type
useoperator_form_type
insteadoperator_options
useoperator_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.
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.
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.
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.
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
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.
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.