Skip to content

[6.x] Fixed deprecated "Doctrine/Common/Inflector/Inflector" class - #32734

Merged
taylorotwell merged 5 commits into
laravel:6.xfrom
andrey-helldar:patch-2020-05-09-11-29
May 11, 2020
Merged

taylorotwell merged 5 commits into
laravel:6.xfrom
andrey-helldar:patch-2020-05-09-11-29

Conversation

@andrey-helldar

Copy link
Copy Markdown
Contributor

The Inflector class is deprecated, use Doctrine\Common\Inflector\Inflector from doctrine/inflector package instead,

New class is non-static Doctrine\Inflector\Inflector::class

I also changed the minimum version for doctrine/inflector package because the earlier 1.1 supports php 5.6 and higher, while Laravel 6.x supports 7.2+.
Package version 1.4 supports php 7.2+.

Also see #32730

@andrey-helldar

andrey-helldar commented May 9, 2020 •

Copy link
Copy Markdown
Contributor Author

@GrahamCampbell,
Thanks, Graham! I constantly forget about doc-blocks 🙁

@taylorotwell
taylorotwell merged commit 95b34d4 into laravel:6.x May 11, 2020
@senter-logistics

Copy link
Copy Markdown

will be this merged to the 7.x version? i'm having this error:
Class 'Doctrine\Inflector\Inflector' not found in
/var/www/html/vendor/laravel/framework/src/Illuminate/Support/Pluralizer.php:135

@GrahamCampbell

Copy link
Copy Markdown
Collaborator

It was merged into 7.x.

@slackernrrd

Copy link
Copy Markdown

This broke som code in a Laravel 6.x project for me after doing composer update, because Eloquent suddenly couldn't find a table due to different pluralization rules in 1.4. It was easy enough to fix by setting the table name explicitly in the affected models, but it was pretty sneaky (and perhaps inevitable) that it just broke.

@GrahamCampbell

Copy link
Copy Markdown
Collaborator

Please report the BC break to the upstream library for them to fix.

@GrahamCampbell

GrahamCampbell commented May 14, 2020 •

Copy link
Copy Markdown
Collaborator

Their pluralisation rules should be the same as in the 1.3.x series.

@senter-logistics

Copy link
Copy Markdown

I downgraded to php 7.2.30 and now it's working as expected.

@tomcastleman

tomcastleman commented May 19, 2020 •

Copy link
Copy Markdown
Contributor

IMO changes from this PR will catch people out, as in our case a composer update resulted in doctrine/inflector to be bumped to ^2.0 which breaks BC (in our case with Eloquent model pluralization).

Yes a solution is to manually require doctrine/inflector:^1.4 in the app (or override the table name in the model) but this PR probably shouldn't offer a bump in the major version of that dependency by default.

PHP 7.4.4
Framework update v6.18.10...v6.18.14

@GrahamCampbell

Copy link
Copy Markdown
Collaborator

Those BC breaks are actually not intended. Please report any pluralisation mistakes to the upstream library to be corrected. v1.4 and v2.0 are meant to be identical apart from deprecated code removed.

@GrahamCampbell

Copy link
Copy Markdown
Collaborator

Yes a solution is to manually require doctrine/inflector:^1.4

As I said, this won't work, because 1.4 is the same as 2.0.

@GrahamCampbell

Copy link
Copy Markdown
Collaborator

Please send fix PRs to the upstream library's 1.4 branch or open issues over there if they have broken something. There's nothing we can do here.

@laravel laravel locked as resolved and limited conversation to collaborators May 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants