Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DateTimeRangeFilter and DateRangeFilter #593

Merged
merged 1 commit into from
May 12, 2021

Conversation

franmomu
Copy link
Member

@franmomu franmomu commented May 12, 2021

Subject

The refactor is based on #142 and https://github.com/sonata-project/SonataDoctrineORMAdminBundle/blob/b59f9e58b8d80ec8fc2e95c5ddff507bd82b8134/src/Filter/AbstractDateFilter.php

I targeted master since there are some BC breaks, maybe this can be done in a BC way, but I don't think it's worth it since we are supposed to release 4.0 soon.

AbstractDateFilter has been refactored to support range queries, similar to the implementation of sonata-project/doctrine-orm-admin-bundle.

The option input_type has been removed since it was not used.

Prior to this change when filtering using a DateFilter or DateTimeFilter with equals type, it created a range
query internally. Now you have to use DateRangeFilter or DateTimeRangeFilter and provide a range of dates.

I am targeting this branch, because these changes break BC.

Closes #550.

Changelog

### Added
- Added `DateRangeFilter` to be able to filter by dates
- Added `DateTimeRangeFilter` to be able to filter by dates with time
### Removed
- Removed unused `input_type` option in `AbstractDateFilter`
- Removed `AbstractDateFilter:: applyTypeIsLessEqual`
- Removed `AbstractDateFilter:: applyTypeIsGreaterThan`
- Removed `AbstractDateFilter:: applyType`
### Fixed
- Fixed using `DateOperatorType::TYPE_EQUAL` type in a `DateFilter` and `DateTimeFilter`, now it filters by the exact date instead of a range.

AbstractDateFilter has been refactored to support range queries
similar to the implementation of sonata-project/doctrine-orm-admin-bundle.

The option input_type has been removed since it was not used.

Prior to this change when filtering using a `DateFilter` or
`DateTimeFilter` with `equals` type, it created a range
query internally. Now you have to use `DateRangeFilter` or
`DateTimeRangeFilter` and provide a range of dates.
@franmomu franmomu added the major label May 12, 2021
@VincentLanglet VincentLanglet requested a review from a team May 12, 2021 08:17
@VincentLanglet VincentLanglet added this to the 4.0 milestone May 12, 2021
@jordisala1991 jordisala1991 merged commit e734c43 into sonata-project:master May 12, 2021
@jordisala1991
Copy link
Member

Thank you @franmomu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants