Framework: Str::singular turns Meta into Metum

Created on 28 Nov 2018  路  3Comments  路  Source: laravel/framework

  • Laravel Version: 5.7.12
  • PHP Version: 7.2.5
  • Database Driver & Version: MySQL 5.7.22

Description:

As mentioned in https://github.com/laravel/nova-issues/issues/918, Meta is always 'singularized' to Metum, causing issues in Nova land.

After digging through the code, I believe this to be the fault of Doctrine's Pluralizer::singular method which Str::singular defers to, so I'm unsure what could be done in Laravel land.

As you can see in https://github.com/laravel/nova-issues/issues/918#issuecomment-434813148, I have managed to work around this with the arguments passed through to the second and third arguments to the HasMany relationship.

Steps To Reproduce:

routes/web.php, add the following code:

Route::get('test', function() {
    return \Illuminate\Support\Str::singular('Meta');
});

Visit laravel.test/test, see Metum.

Most helpful comment

Laravel uses the Doctrine inflector for pluralizing/singularizing so you'll need to raise an issue there: https://github.com/doctrine/inflector

All 3 comments

Accordingly Wikitionary:

  • Singular: Meta
  • Plural: Metas

Laravel uses the Doctrine inflector for pluralizing/singularizing so you'll need to raise an issue there: https://github.com/doctrine/inflector

Thanks @driesvints, have done. What a journey this issue is ha.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jackmu95 picture jackmu95  路  3Comments

iivanov2 picture iivanov2  路  3Comments

felixsanz picture felixsanz  路  3Comments

PhiloNL picture PhiloNL  路  3Comments

YannPl picture YannPl  路  3Comments