Skip to content

Commit

Permalink
Bartheyrman22 patch 1 (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartheyrman22 authored Sep 25, 2024
1 parent 7aaaf5c commit 6ddacfe
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions Resources/doc/working-with-the-bundle.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,14 +498,6 @@ class LocaleFilterType extends AbstractType
}
```

Then defined the `LocaleFilterType` as a service and remember to add the `form.type` tag:

```xml
<service id="something.type.filter_locale" class="Super\Namespace\Type\LocaleFilterType">
<tag name="form.type" />
</service>
```

Now we can use the `LocaleFilterType` type, but no filter will be applied. To apply a filter we need to listen some event, so let's create a subscriber:

```php
Expand All @@ -523,10 +515,12 @@ class FilterSubscriber implements EventSubscriberInterface
{
return [
// if a Doctrine\ORM\QueryBuilder is passed to the spiriit_form_filter.query_builder_updater service
'spiriit_form_filter.apply.orm.filter_locale' => ['filterLocale'],
// "locale_filter" is the block prefix of the LocaleFilterType
'spiriit_form_filter.apply.orm.locale_filter' => ['filterLocale'],

// if a Doctrine\DBAL\Query\QueryBuilder is passed to the spiriit_form_filter.query_builder_updater service
'spiriit_form_filter.apply.dbal.filter_locale' => ['filterLocale'],
// "locale_filter" is the block prefix of the LocaleFilterType
'spiriit_form_filter.apply.dbal.locale_filter' => ['filterLocale'],
];
}

Expand Down

0 comments on commit 6ddacfe

Please sign in to comment.