Closed micheh closed 1 year ago
:+1: to continue that work!
👍 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.
Maybe it would make sense to replace
doctrine/inflector
with thesymfony/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.
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: https://github.com/doctrine/inflector/issues/221#issuecomment-1595341265Maybe it would make sense to replace
doctrine/inflector
with thesymfony/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: https://github.com/api-platform/core/pull/3580Example
API Resource name: Permission Route using
doctrine/inflector:2.0.6
: /api/permissions Route usingdoctrine/inflector:2.0.7
: /api/permission Route usingdoctrine/inflector:2.0.8
: /api/permissions