Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<anything>_data singularization returns unexpected result (<anything>_datum) #137

Open
peter-bolemant opened this issue Feb 18, 2020 · 4 comments

Comments

@peter-bolemant
Copy link

Singularization of foo_data returns foo_datum

Even if datum can be considered to be the singular form of data, I think in the case of the lib use it can be quite confusing. Singularization of data returns data, as one would expect.

@malarzm
Copy link
Member

malarzm commented Feb 18, 2020

AFAICT Inflector is designed to work with single words. Trying to make it work with two words (separated by either space or whatever else like _ in your case) is outside of the scope of interest of this library.

@peter-bolemant
Copy link
Author

That's possible, however I opened this topic in Laravel and they referenced me here, it can cause big problems in some cases - laravel/framework#31517 (comment)

@alcaeus
Copy link
Member

alcaeus commented Feb 19, 2020

If you could come up with some tests or a list of expected behaviour I can take a look.

@peter-bolemant
Copy link
Author

peter-bolemant commented Mar 24, 2020

looks like the behaviour has changed or Laravel's making some further string manipulation (not quite likely according to their response), however tested doctrine/inflector: 1.3.1

echo Inflector::singularize('data'); // results in datum - I'd expect data
echo Inflector::singularize('personal_data'); // results in personal_datum - I'd expect personal_data

echo Inflector::pluralize('data'); // results in data as expected
echo Inflector::pluralize('personal_data'); // results in personal_datas - I'd expect personal_data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants