Skip to content

Filter reference

Inherit options

hidden

type: boolean

Controls if the filter is visible. Default is true

yaml
columns:
    myFilter:
        hidden: false

initial_active

type: boolean

Controls if the filter is initially visible and doesn't need to be activated via the filters dropdown first. Default is false

yaml
columns:
    myFilter:
        initial_active: true

initial_value

type: string|null

If set, this filter will be initially have a set value and the list will initially be filtered by this value. Default null.

yaml
columns:
    myFilter:
        initial_value: Foo

label

type: string

The label of the filter. It will be translated over the translation service automatically. (See translation_domain)

yaml
columns:
    myFilter:
        label: myLabel

permission

type: string|null

Symfony security role required for the user to be able to see and use the filter. Default is null.

yaml
columns:
    myFilter:
        permission: ROLE_ENHAVO_ARTICLE_ARTICLE_EDIT

property

type: string

Define which property of the resource is used for this filter. The resource has to provide a getter method for that property.

yaml
filters:
    myFilter:
        property: name

translation_domain

type: string

Overwrite the default translationDomain. EnhavoAppBundle is used by default.

yaml
columns:
    myFilter:
        translation_domain: myTranslationDomain

Age

The AgeFilter can be used to filter an age in full years. The parameter property needs to refer to a date representing the date of birth/origin, and the age is calculated from that date until today.

Typetext
ClassEnhavo\Bundle\AppBundle\Filter\Type\AgeFilter
Optionsproperty*, label_from, label_to
Inherit Optionslabel, locale, format, initial_active, initial_value, condition, width, permission, component

label_from

type: string|null

The label for the field where the user can set the lower value of the range. It will be translated over the translation service automatically. (See translation_domain) If not set, the value of label will be used. If that one is also null, no label will be displayed.

yaml
columns:
    myFilter:
        label_from: myRange from

label_to

type: string|null

The label for the field where the user can set the lower value of the range. If not set, the value of label will be used. If that one is also null, no label will be displayed. It will be translated over the translation service automatically. (See translation_domain)

yaml
columns:
    myFilter:
        label_to: to

label

type: string|null

The label of the filter in the filter dropdown. If not set, the value of label_from will be used. It will be translated over the translation service automatically. (See translation_domain)

yaml
columns:
    myFilter:
        label: myLabel

Auto Complete

The EntityFilter filters a property for entities as a dropdown.

It is not recommended to use this filter if the number of possible entities is possible to become very big. If this is the case, consider using AutoCompleteEntityFilter instead.

Typeauto_complete_entity
ClassEnhavo\Bundle\AppBundle\Filter\Type\AutoCompleteEntityFilter
Optionsroute*, property*, label*, route_parametersminimum_input_length
Inherit Optionslabel, locale, format, initial_active, initial_value, initial_value_arguments, initial_value_repository, initial_value_choice_label, condition, width, permission, component

route

type: string

Route that will be called for the autocomplete search. The route will be used in the following way:

  • Get-Parameter [q]{.title-ref} will have the search term as a string
  • Get-Parameter [page]{.title-ref} will be an integer representing the pagination page
  • Additional parameters may be defined via the parameter route_parameters
  • The result must be a json array with the results in the format: [{ code: id; label: "Label" }]
yaml
filter:
    myFilter:
        route: my_entity_autocomplete_route

route_parameters

type: array

Optional additional parameters for the route defined in route. Default is an empty array.

yaml
filter:
    myFilter:
        route: my_entity_autocomplete_route
        route_parameters: { foo: "bar" }

minimum_input_length

type: int

The minimum number of characters before an autocomplete search is started. Default is [3]{.title-ref}.

yaml
filter:
    myFilter:
        minimum_input_length: 5

initial_value

type: string|null

If set, this filter will be initially have a set value and the list will initially be filtered by this value. This must be a method of the repository defined by the parameter initial_value_repository which returns either a single object or an array with at least one entry (the first entry will be used). Default [null]{.title-ref}.

yaml
columns:
    myFilter:
        initial_value: findByFoo
        initial_value_repository: AppBundle\Repository\MyEntityRepository

initial_value_arguments

type: [array|null]

Optional arguments that will be added to the call of the repository method in parameter initial_value. Default is [null]{.title-ref}.

yaml
columns:
    myFilter:
        initial_value: findByFoo
        initial_value_arguments: { foo: 'bar' }

initial_value_repository

type: string|null

This parameter is needed and no longer optional if initial_value is not null.

Either the name of a public service that points to the entity's repository or the FQCN of the entity to be used on EntityManager::getRepository(). This will be used to find the initial value.

Default is [null]{.title-ref}.

yaml
columns:
    myFilter:
        initial_value: findByFoo
        initial_value_repository: AppBundle\Repository\MyEntityRepository

initial_value_choice_label

type: string|null

Property of the entity that will be used as label of the initial value if initial_value is set. Default is [null]{.title-ref}.

yaml
filter:
    myFilter:
        initial_value: findByFoo
        initial_value_repository: AppBundle\Repository\MyEntityRepository
        initial_value_choice_label: title

Between

The BetweenFilter can be used to filter in a range between two values. It works on any type that can be compared using ">=" and "<=" in the database query.

Typebetween
ClassEnhavo\Bundle\AppBundle\Filter\Type\BetweenFilter
Optionsproperty*, label_from, label_to
Inherit Optionslabel, locale, format, condition, width, permission, component

label_from

type: string|null

The label for the field where the user can set the lower value of the range. It will be translated over the translation service automatically. (See translation_domain) If not set, the value of label will be used. If that one is also null, no label will be displayed.

yaml
columns:
    myFilter:
        label_from: myRange from

label_to

type: string|null

The label for the field where the user can set the lower value of the range. If not set, the value of label will be used. If that one is also null, no label will be displayed. It will be translated over the translation service automatically. (See translation_domain)

yaml
columns:
    myFilter:
        label_to: to

label

type: string|null

The label of the filter in the filter dropdown. If not set, the value of label_from will be used. It will be translated over the translation service automatically. (See translation_domain)

yaml
columns:
    myFilter:
        label: myLabel

Boolean

The BooleanFilter filters a boolean property. It has two distinct variants depending on the parameter checkbox.

If checkbox is true, the filter will be rendered as a checkbox. If the checkbox is unchecked, the filter will be inactive and allow any value on the target's property field. If the checkbox is checked, only values equal to this filter's parameter equals are allowed. In the checkbox variant, there is no way to filter for the opposite of what the parameter equals is set to.

If checkbox is false, the filter will be rendered as a dropdown with both the option of filtering for true, for false and for an inactive filter.

Typeboolean
ClassEnhavo\Bundle\AppBundle\Filter\Type\BooleanFilterType
Optionsproperty*, label*, checkbox, equals, label_true, label_false
Inherit Optionslabel, locale, format, initial_active, initial_value, condition, width, permission, component

checkbox

type: boolean

Controls whether the filter is displayed as a checkbox or a dropdown. Default is [true]{.title-ref}.

yaml
filter:
    myFilter:
        type: boolean
        checkbox: false

equals

type: boolean

Only used if checkbox is true. Controls whether an active filter allows for the property to be true or false. Default is [true]{.title-ref}.

yaml
filter:
    myFilter:
        type: boolean
        equals: true

label_true

type: string

Only used if checkbox is false. Controls the label of the dropdown entry for the value true. Default [filter.boolean.label_true]{.title-ref}. Will be translated over the translation service automatically. (See translation_domain)

yaml
filter:
    myFilter:
        type: boolean
        label_true: Yes

label_false

type: string

Only used if checkbox is false. Controls the label of the dropdown entry for the value false. Default [filter.boolean.label_false]{.title-ref}. Will be translated over the translation service automatically. (See translation_domain)

yaml
filter:
    myFilter:
        type: boolean
        label_false: No

Date Between

The DateBetweenFilter can be used to filter for dates in a range.

Typedate_between
ClassEnhavo\Bundle\AppBundle\Filter\Type\DateBetweenFilter
Optionsproperty*, label_from, label_to
Inherit Optionslabel, locale, format, initial_active, initial_value, condition, width, permission, component

label_from

type: string|null

The label for the field where the user can set the lower value of the range. It will be translated over the translation service automatically. (See translation_domain) If not set, the value of label will be used. If that one is also null, no label will be displayed.

yaml
columns:
    myFilter:
        label_from: myRange from

label_to

type: string|null

The label for the field where the user can set the lower value of the range. If not set, the value of label will be used. If that one is also null, no label will be displayed. It will be translated over the translation service automatically. (See translation_domain)

yaml
columns:
    myFilter:
        label_to: to

label

type: string|null

The label of the filter in the filter dropdown. If not set, the value of label_from will be used. It will be translated over the translation service automatically. (See translation_domain)

yaml
columns:
    myFilter:
        label: myLabel

locale

type: string

The locale used for the Datepicker form fields. Defaults is the default locale of the project.

yaml
columns:
    myFilter:
        locale: en

format

type: string

The date format used for the Datepicker form fields. Uses the date format of vue3-datepicker. Default is [dd.MM.yyyy]{.title-ref}.

yaml
columns:
    myFilter:
        format: yyyy-MM-dd

Entity

The EntityFilter filters a property for entities as a dropdown.

If the number of possible entities is large, this filter will negatively effect performance. If this is the case, consider using AutoCompleteEntityFilter instead.

Typeentity
ClassEnhavo\Bundle\AppBundle\Filter\Type\EntityFilter
Optionsrepository*, property*, label*, method, arguments, choice_label
Inherit Optionslabel, locale, format, initial_active, initial_value, condition, width, permission, component

repository

type: string

Either the name of a public service that points to the entity's repository or the FQCN of the entity to be used on EntityManager::getRepository().

yaml
filter:
    myFilter:
        repository: AppBundle\Repository\MyEntityRepository

method

type: string

The name of the method of the repository which should be called. Default is [findAll]{.title-ref}.

yaml
filter:
    myFilter:
        method: findAll

arguments

type: [array|null]

Optional arguments that will be added to the call of the repository method. Default is [null]{.title-ref}.

yaml
filter:
    myFilter:
        method: findBy
        arguments: { public: true }

choice_label

type: string|null

Property of the entity that will be used as label in the options list.

yaml
filter:
    myFilter:
        choice_label: title

initial_value

type: string|null

If set, this filter will be initially have a set value and the list will initially be filtered by this value. This must be a method of the repository defined by the parameter repository which returns either a single object or an array with at least one entry (the first entry will be used). Default [null]{.title-ref}.

yaml
columns:
    myFilter:
        initial_value: findByFoo

initial_value_arguments

type: array

Optional arguments that will be added to the call of the repository method in parameter initial_value. Default is [null]{.title-ref}.

yaml
columns:
    myFilter:
        initial_value: findByFoo
        initial_value_arguments: { foo: 'bar' }

Option

The OptionFilter filters a property for specific options.

Typeoption
ClassEnhavo\Bundle\AppBundle\Filter\Type\OptionFilter
Optionsoptions*, property*, label*,
Inherit Optionslabel, locale, format, initial_active, initial_value, condition, width, permission, component

options

type: array<string>

Define the options, which the user can choose

yaml
filter:
    myFilter:
        options:
            Foo: Bar
            Hello: World

initial_value

type: string|null

If set, this filter will be initially have a set value and the list will initially be filtered by this value. This must be NULL or one of the array keys in the parameter options. Default is null.

yaml
columns:
    myFilter:
        initial_value: Foo

Taxonomy

The TaxonomyFilter filters by a taxonomy.

Typetaxonomy
ClassEnhavo\Bundle\TaxonomyBundle\Filter\TaxonomyFilterType
Optionstaxonomy*, property*, label*
Inherit Optionslabel, locale, format, initial_active, initial_value, condition, width, permission, component

taxonomy

type: string

The slug of the Taxonomy.

yaml
columns:
    myFilter:
        type: taxonomy
        operator: article_category

initial_value_method

type: string|null

Defines the repository method to use when setting the initial value. Default [findOneByNameAndTaxonomy]{.title-ref}. If multiple results are returned by the method, the first one is used.

yaml
columns:
    myFilter:
        initial_value: Foo
        initial_value_method: findOneByBar

initial_value_arguments

type: string|null

Optional arguments that will be added to the call of the repository method. Default is an array containing the values of parameters initial_value and taxonomy.

yaml
columns:
    myFilter:
        initial_value: Foo
        initial_value_method: findOneByFoo
        initial_value_arguments: { foo: 'bar' }

Text

The TextFilter filters a property by user string

Typetext
ClassEnhavo\Bundle\AppBundle\Filter\Type\TextFilter
Optionsproperty*, label*, operator
Inherit Optionslabel, locale, format, initial_active, initial_value, condition, width, permission, component

operator

type: string

The operator used when applying this filter to the database search. Can be one of the following:

  • =
  • !=
  • like (default)
  • start_like
  • end_like

Default is [like]{.title-ref}.

yaml
columns:
    myFilter:
        type: text
        operator: start_like