-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
When you create a widget Filter you can choose a filter in the list but each filter is set for a specific association and a specific field name. So we need to re-create a filter every time we want filter on a property.
For me the best process to generate a filter is:
- choose the listing
- list fields of the entity listed and select
- choose the default filter based on the field : string, onetomany, ... or a specific filter that was created for this type of relation.
Each filter can be define with a list of metadatas to define the relation it can be used:
services.yml
acme.user_gender_filter:
class: AcmeBundle\Filter\UserGenderFilter
parent: victoire_filter.filter.many_to_one_filter
tags:
- { name: form.type }
- { name: victoire_core.filter, relation: ManyToOne, targetEntity: AcmeBundle\Entity\User}Book.php
class Book
{
/**
* @ORM\ManyToOne(targetEntity="AcmeBundle\Entity\User", inversedBy="books")
*/
private $author;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
}Then in this example we can create a filter on a list of books like this:

If "Default" filter is the only available filter the select of filters is not display.
Reactions are currently unavailable