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

Singular form of generated methods should end with 'y' when property ends with 'ies' #530

Closed
wants to merge 1 commit into from

Conversation

stollr
Copy link
Contributor

@stollr stollr commented Dec 4, 2012

The singular form is not correctly detected if the property ends with 'ies' like 'entries' which should be transformed to 'entry'.
This change is related to http://www.doctrine-project.org/jira/browse/DDC-2184

@doctrinebot
Copy link

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DDC-2184

@doctrinebot
Copy link

Oh btw, I just (automatically) realized that you are not creating this pull request against the master branch.

Unless there are good reasons for this, i would suggest to close and rebase the Pull Request against master and then create it again. Sorry!

@Ocramius
Copy link
Member

Ocramius commented Dec 4, 2012

Wasn't the last suggestion about using a more advanced inflector?

@stollr
Copy link
Contributor Author

stollr commented Dec 4, 2012

Which suggestion do you mean?

@beberlei
Copy link
Member

beberlei commented Jan 6, 2013

I would take the code from cakephp that does singularize and pluralize https://github.com/cakephp/cakephp/blob/master/lib/Cake/Utility/Inflector.php including tests https://github.com/cakephp/cakephp/blob/master/lib/Cake/Test/Case/Utility/InflectorTest.php
and move it to Doctrine\Common\Util\Inflector - then use that API to do this singular/plural changes.

@jbergler
Copy link

jbergler commented Jan 6, 2013

@beberlei I have already created PR against Doctrine\Common\Util\Inflector here https://github.com/doctrine/common/pull/227/files

I should also add that those changes use the code from CakePHP and I think I have a PR ready to push which makes the changes here to utilise the Util class once its been committed.

@stollr
Copy link
Contributor Author

stollr commented Jan 7, 2013

Okay, so I'll close this pull request ;)

@stollr stollr closed this Jan 7, 2013
@promethean
Copy link

@Naitsirch @jbergler running 2.3.4 these issues with generated Entity method names ending 'ie' are remaining.

I am using yaml notation and from this kind of notation in yaml:

  oneToMany:
      tradedSecurities:
        targetEntity: Security
        mappedBy: tradingCountry

This kind of (wrongly named) method gets generated:

public function addTradedSecuritie(\X\Y\Entity\Security $tradedSecurities)
{
    $this->tradedSecurities[] = $tradedSecurities;

    return $this;
}

If this bug was resolved then I would have expected these issues to disappear ?

@stollr
Copy link
Contributor Author

stollr commented Jul 4, 2013

Yes, I am experiencing this behaviour in latest 2.3.x, too, but haven't looked into the code again. It seems like doctrine/common#227 should have fixed this issue. Maybe it has not been merged into 2.3.x?

@beberlei What is the current status?

@Ocramius
Copy link
Member

Ocramius commented Jul 5, 2013

@Naitsirch including doctrine/common#227 into 2.3 is a no-go in my opinion, that's quite a break (and a new feature)

@stollr
Copy link
Contributor Author

stollr commented Jul 5, 2013

In my opinion it's a bug fix ^^ because the current behaviour is not correct.
But I just wanted to know where the fix will be applied to

@jbergler
Copy link

@Naitsirch Short answer, looks like the changes are in 2.4 to use doctrine/inflector
see doctrine/common@18b2c6e

@afilina
Copy link

afilina commented Oct 9, 2013

My "categories" are still generating "addCategorie"

@Ocramius
Copy link
Member

@afilina this with the new inflector?

@afilina
Copy link

afilina commented Oct 17, 2013

@Ocramius My mistake, I had <2.4-dev in my composer file. I changed to the higher version and updated dependencies. My function names are now correct. Thanks.

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

Successfully merging this pull request may close these issues.

None yet

8 participants