Open tomcastleman opened 4 years ago
Yeh, this is worth discussion, and this is the right place for it (and not on closed/merged PRs). :)
Something we could consider is moving to symfony's inflector in Laravel 8 or 9.
Something we could consider is moving to symfony's inflector in Laravel 8 or 9.
What's the major difference between Symfony's and Doctrine's Inflector?
I recently encountered an issue where fixes to pluralization rules of
doctrine/inflector
in a non-major package upgrade broke BC in a Laravel app due to Eloquent's use of inflection by default in the generation of table names and such. The thread was closed by @grahamcampbell so I thought I'd move it here.I raised the question with the maintainer of
doctrine/inflection
who confirmed that pluralization rule fixes are indeed made in non-major version upgrades of the package. He also shared his opinion which you can read there.Using an inflector for table names and critical parts of the DB layer seems a bit flawed to me if the pluralization rules are going to change under the hood without a major version upgrade, potentially breaking production apps if not caught.
For small well-tested apps, sure it's easy to find the issue (hopefully with failing tests) and quickly manually override the
Model::$table
property for example, but there could well be cases where it's not so obvious something has broken and for the consequences to be more severe. Particularly for less experienced devs.Would be interested in the opinion of others!