Doctrine ORM DateRangeFilterType
The Doctrine ORM DateRangeFilterType
represents a filter that operates on a two date values that make a range.
Options
This column type has no additional options.
Inherited options
label
- type:
null
,false
,string
orSymfony\Component\Translation\TranslatableInterface
- default:
null
Sets the label that will be used when rendering the filter.
When value is null
, a sentence cased filter name is used as a label, for example:
Filter name | Guessed label |
---|---|
name | Name |
firstName | First name |
label_translation_parameters
- type:
array
- default:
[]
Sets the parameters used when translating the label
option.
translation_domain
- type:
false
orstring
- default:
'KreyuDataTable'
Sets the translation domain used when translating the translatable filter values.
Setting the option to false
disables translation for the filter.
query_path
- type:
null
orstring
- default:
null
the query path is guessed from the filter name
Sets the path used in the proxy query to perform the filtering on.
form_type
- type:
string
- default:
'Kreyu\Bundle\DataTableBundle\Filter\Form\Type\DateRangeType'
This is the form type used to render the filter value field.
form_options
- type:
array
- default:
This is the array that's passed to the form type specified in the form_type
option.
operator_form_type
- type:
string
- default:
'Kreyu\Bundle\DataTableBundle\Filter\Form\Type\OperatorType'
This is the form type used to render the filter operator field.
operator_form_options
- type:
array
- default:
[]
This is the array that's passed to the form type specified in the operator_form_type
option.
operator_selectable
- type:
bool
- default:
false
Determines whether the operator can be selected by the user.
default_operator
- type:
Kreyu\Bundle\DataTableBundle\Filter\Operator
- default:
Kreyu\Bundle\DataTableBundle\Filter\Operator::Between
Determines a default operator for the filter.
trim
- type:
bool
- default:
false
Determines whether the TRIM()
function should be applied on the expression. Uses the TrimExpressionTransformer
transformer.
lower
- type:
bool
- default:
false
Determines whether the LOWER()
function should be applied on the expression. Uses the LowerExpressionTransformer
transformer.
upper
- type:
bool
- default:
false
Determines whether the UPPER()
function should be applied on the expression. Uses the UpperExpressionTransformer
transformer.
expression_transformers
- type:
ExpressionTransformerInterface[]
- default:
[]
Defines expression transformers to apply on the expression.
use App\DataTable\Filter\ExpressionTransformer\UnaccentExpressionTransformer;
use Kreyu\Bundle\DataTableBundle\Type\AbstractDataTableType;
use Kreyu\Bundle\DataTableBundle\DataTableBuilderInterface;
use Kreyu\Bundle\DataTableBundle\Bridge\Doctrine\Orm\Filter\ExpressionTransformer\LowerExpressionTransformer;
use Kreyu\Bundle\DataTableBundle\Bridge\Doctrine\Orm\Filter\ExpressionTransformer\TrimExpressionTransformer;
use Kreyu\Bundle\DataTableBundle\Bridge\Doctrine\Orm\Filter\Type\TextFilterType;
class ProductDataTableType extends AbstractDataTableType
{
public function buildDataTable(DataTableBuilderInterface $builder, array $options): void
{
$builder
->addFilter('name', TextFilterType::class, [
'expression_transformers' => [
new LowerExpressionTransformer(),
new TrimExpressionTransformer(),
],
])
;
}
}
For more information about expression transformers, read here.