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

feat(doctrine): boolean filter like laravel filters #6749

Conversation

vinceAmstoutz
Copy link
Contributor

@vinceAmstoutz vinceAmstoutz commented Oct 24, 2024

Q A
Branch? main
License MIT
Doc PR Coming soon

Goal:

Using filters as we use Laravel filters. Example with Symfony:

#[ApiResource]
#[GetCollection(
    parameters: [
        'active' => new QueryParameter(
            filter: new BooleanFilter(),
        ),

        // support also for filter aliasing
        'enabled' => new QueryParameter(
            filter: new BooleanFilter(),
            property: 'active',
        ),
    ],
)]
#[ORM\Entity]
class FilteredBooleanParameter {
    // ...
}

TODO:

  • Check swagger UI to see what it's like
  • Do the job for Doctrine ODM (MongoDM)
  • Fix PHPStan
  • Fix MongoDM tests

@vinceAmstoutz vinceAmstoutz force-pushed the feat-doctrine-boolean-filter-like-laravel-filters branch 6 times, most recently from cc689c3 to c5de0d4 Compare October 26, 2024 14:14
@vinceAmstoutz
Copy link
Contributor Author

@soyuka looks like this in Swagger UI:
image
image
image

@vinceAmstoutz vinceAmstoutz force-pushed the feat-doctrine-boolean-filter-like-laravel-filters branch 7 times, most recently from 2e2f570 to 1892e6a Compare October 26, 2024 18:47
@vinceAmstoutz vinceAmstoutz marked this pull request as ready for review October 26, 2024 18:57
Copy link
Member

@soyuka soyuka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice start! A few comments left to be done!

src/Doctrine/Odm/Extension/ParameterExtension.php Outdated Show resolved Hide resolved
src/Doctrine/Odm/Extension/ParameterExtension.php Outdated Show resolved Hide resolved
src/Doctrine/Odm/Extension/ParameterExtension.php Outdated Show resolved Hide resolved
src/Doctrine/Odm/Filter/AbstractFilter.php Outdated Show resolved Hide resolved
src/Doctrine/Odm/Filter/AbstractFilter.php Outdated Show resolved Hide resolved
src/Doctrine/Odm/Filter/BooleanFilter.php Outdated Show resolved Hide resolved
src/Doctrine/Orm/Extension/ParameterExtension.php Outdated Show resolved Hide resolved
src/Doctrine/Orm/Filter/BooleanFilter.php Outdated Show resolved Hide resolved
tests/Functional/Parameters/BooleanFilterTest.php Outdated Show resolved Hide resolved
tests/Functional/Parameters/BooleanFilterTest.php Outdated Show resolved Hide resolved
@vinceAmstoutz vinceAmstoutz force-pushed the feat-doctrine-boolean-filter-like-laravel-filters branch 5 times, most recently from 04a24ac to b1026cb Compare October 31, 2024 15:35
src/Doctrine/Odm/Extension/ParameterExtension.php Outdated Show resolved Hide resolved
src/Doctrine/Odm/Extension/ParameterExtension.php Outdated Show resolved Hide resolved
src/Doctrine/Odm/Extension/ParameterExtension.php Outdated Show resolved Hide resolved
src/Doctrine/Odm/Filter/AbstractFilter.php Show resolved Hide resolved
@vinceAmstoutz vinceAmstoutz force-pushed the feat-doctrine-boolean-filter-like-laravel-filters branch 3 times, most recently from 6887caf to a5fe140 Compare November 4, 2024 11:26
src/Doctrine/Odm/Extension/ParameterExtension.php Outdated Show resolved Hide resolved
src/Doctrine/Odm/Extension/ParameterExtension.php Outdated Show resolved Hide resolved
src/Doctrine/Odm/Extension/ParameterExtension.php Outdated Show resolved Hide resolved
src/Doctrine/Odm/Filter/AbstractFilter.php Outdated Show resolved Hide resolved
src/Doctrine/Orm/PropertyHelperTrait.php Show resolved Hide resolved
tests/Functional/Parameters/BooleanFilterTest.php Outdated Show resolved Hide resolved
tests/Functional/Parameters/BooleanFilterTest.php Outdated Show resolved Hide resolved
tests/Functional/Parameters/BooleanFilterTest.php Outdated Show resolved Hide resolved
@vinceAmstoutz vinceAmstoutz force-pushed the feat-doctrine-boolean-filter-like-laravel-filters branch 2 times, most recently from 1130a1a to 13c15dd Compare November 4, 2024 16:02
@vinceAmstoutz vinceAmstoutz force-pushed the feat-doctrine-boolean-filter-like-laravel-filters branch 2 times, most recently from c5c4b19 to cbe1cff Compare November 5, 2024 09:00
@vinceAmstoutz vinceAmstoutz force-pushed the feat-doctrine-boolean-filter-like-laravel-filters branch from cbe1cff to fd22d9c Compare November 5, 2024 09:25
@vinceAmstoutz vinceAmstoutz deleted the feat-doctrine-boolean-filter-like-laravel-filters branch November 5, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants