cakephp / cakephp

CakePHP: The Rapid Development Framework for PHP - Official Repository
http://cakephp.org
MIT License
8.68k stars 3.44k forks source link

Inflector singularizes `meta` as `metum` #17717

Closed mehov closed 1 week ago

mehov commented 1 week ago

Description

https://inflector.cakephp.org/Commentsmeta

singularize | => | Commentsmetum classify | => | Commentsmetum

Shouldn't it just stay meta?

CakePHP Version

5

PHP Version

No response

markstory commented 1 week ago

Because the 'meta' is embedded in another word the existing Inflector rules don't catch it. You could either add Inflector rules to your application to handle this, send a pull request to expand the core inflection rules, or use a name like CommentsMetas which will singularize to CommentsMeta

mehov commented 1 week ago

add Inflector rules to your application to handle this

That's what I'll go with. Thank you!

https://book.cakephp.org/4/en/core-libraries/inflector.html#inflection-configuration

Inflector::rules('singular', ['/(meta)$/i' => '\1']);