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

Incorrect entity generation when multiple links on target entities #50

Closed
Schyzophrenic opened this issue Mar 31, 2012 · 2 comments
Closed

Comments

@Schyzophrenic
Copy link

Hello,

I use Symfony 2.0.9. I guess this is linked directly to the doctrine / doctrine bundle.
EDIT: I found the issue in JIRA : http://www.doctrine-project.org/jira/browse/DDC-1497
I am unsure whether I should keep this issue in github then...

I have a User entity, which references a Band entity as an arrayCollection ($bands). So far everything is fine.

Then I try to setup 2 new variables as :

  • $favoriteBands with a ManyToMany relationship
  • $favoriteAlbums with a ManyToMany relationship

When generating the entity via php app/console doctrine:generate:entities AcmeMyBundle I have the following behavior:
for the bands:

/**
     * Add favoritealbums
     *
     * @param Acme\MyBundle\Entity\Album $favoritealbums
     */
    public function addAlbum(\Acme\MyBundle\Entity\Album $favoritealbums)
    {
        $this->favoritealbums[] = $favoritealbums;
    }

    /**
     * Get favoritealbums
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getFavoritealbums()
    {
        return $this->favoritealbums;
    }

I feel like I should have addFavoriteAlbum instead of addAlbum...

Furthermore, concerning the $favoriteBands, I only have the getter generated as the setter is considered, I assume, already generated (since I already have a "addBand" method coming from the $bands collection already registered).

Can you please fix it (or tell me if I am doing something wrong!)

@stof
Copy link
Member

stof commented Mar 31, 2012

As I said when you opened the issue on the Symfony repo, the EntityGenerator comes from Doctrine. It does not come from DoctrineBundle. Please report it in the Doctrine issue tracker

@stof stof closed this as completed Mar 31, 2012
@Schyzophrenic
Copy link
Author

@stof Sorry about that! I have indeed dig up the code where the error lives and it was inside the Doctrine itself.
As mentioned in my previous edit, I have found the same bug referenced on the Doctrine jira issue tracker.
Thank you again and sorry for creating useless tickets...

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

2 participants