inflector icon indicating copy to clipboard operation
inflector copied to clipboard

Deprecation of methods as being dropped in 2.x

Open raziel057 opened this issue 4 years ago • 7 comments

It's strange that you deprecate the following methods (tableize, classify, ...), because it's still used in Doctrine ORM:

For example Inflector::classify is used in: https://github.com/doctrine/orm/blob/master/lib/Doctrine/ORM/EntityRepository.php

raziel057 avatar May 12 '20 17:05 raziel057

The deprecation refers to the legacy API and instructs users to switch to the new API (found in the Doctrine\Inflector namespace without “Common”). The logic is still available.

alcaeus avatar May 13 '20 06:05 alcaeus

... instructs users to switch to the new API (found in the Doctrine\Inflector namespace without “Common”)

On Laravel what would I replace this with when adding new rules? Because Doctrine\Inflector\Inflector::rules is no good

Doctrine\Common\Inflector\Inflector::rules('plural', [
    '/^is$/' => 'are',
    '/^Is$/' => 'Are'
]);

Healyhatman avatar May 13 '20 08:05 Healyhatman

@Healyhatman I'm also experiencing the same issue but there is no documentation for how to migrate from this.

@alcaeus Do you have any insight on how to migrate to the new method of adding irregular inflection rules?

ninjasitm avatar Jun 02 '20 14:06 ninjasitm

@Healyhatman @ninjasitm There is already documentation written for this: https://github.com/doctrine/inflector/blob/master/docs/en/index.rst

garrettw avatar Jun 02 '20 15:06 garrettw

@garrettw Yes. But how do we do this in Laravel? Here you have to create an inflector instance where as before it was created statically. Can you help me out on this in case I'm missing something really simple?

ninjasitm avatar Jun 02 '20 16:06 ninjasitm

@ninjasitm I'd suggest asking Laravel community about this. We're not documenting how other frameworks use and expose usage of Inflector to their users

malarzm avatar Jun 02 '20 16:06 malarzm

OK. Will create an issue on the laravel/framework github repo. If I find a solution I'll link back here.

ninjasitm avatar Jun 02 '20 16:06 ninjasitm