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

Replace doctrine/inflector with symfony/string? #5636

Closed
micheh opened this issue Jun 19, 2023 · 3 comments
Closed

Replace doctrine/inflector with symfony/string? #5636

micheh opened this issue Jun 19, 2023 · 3 comments

Comments

@micheh
Copy link

micheh commented Jun 19, 2023

Description
Currently the package doctrine/inflector is used to build the route of a resource. Doctrine updated this package in a patch release to generate a different plural for some words. This means that API Platform built different routes for some entities. The change was later reversed in another patch release, but Doctrine will probably adjust some words again in the next major release. They generally advise to use this package only for one-time text or code generation, where you do not need a stable pluralization: doctrine/inflector#221 (comment)

Maybe it would make sense to replace doctrine/inflector with the symfony/string component, as the generated routes should be more stable and use more advanced pluralization? There was once a pull request to do this, but it was abandoned: #3580

Example
API Resource name: Permission
Route using doctrine/inflector:2.0.6: /api/permissions
Route using doctrine/inflector:2.0.7: /api/permission
Route using doctrine/inflector:2.0.8: /api/permissions

@soyuka
Copy link
Member

soyuka commented Jun 20, 2023

👍 to continue that work!

@dunglas
Copy link
Member

dunglas commented Jun 20, 2023

👍 to deprecate using Doctrine Inflector in core and switch to Symfony too. We’ll have to support Doctrine Inflector until v4 for the sake of backward compatibility, thought.

@derrabus
Copy link
Contributor

Maybe it would make sense to replace doctrine/inflector with the symfony/string component, as the generated routes should be more stable

Symfony's policy on fixing pluralization rules is not that different from Doctrine's. That being said, switching to Symfony String is probably a good move for API Platform.

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

No branches or pull requests

4 participants