Skip to content

Explaining the "one-to-many" case more explicitly #9259

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

Closed
wants to merge 2 commits into from

Conversation

ThomasLandauer
Copy link
Contributor

Please double-check: I'm not certain if "For a many-to-many relationship:" (line 574) is correct!

Please double-check: I'm not certain if "For a many-to-many relationship:" (line 574) is correct!
``false``::
``false``.

For a one-to-many relationship you just need to add one line to ``Task``:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is misleading, in fact it's the opposite here (i.e. many-to-one). Maybe we should just manage this using inline comments like this:

public function addTag(Tag $tag)
{
    // for a many-to-many association
    $tag->addTask($this);

    // for a many-to-one association
    $tag->setTask($this);

    $this->tags->add($tag);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xabbuh xabbuh added this to the 2.7 milestone Feb 23, 2018
@xabbuh xabbuh added the Form label Feb 23, 2018
@javiereguiluz
Copy link
Member

Thanks Thomas.

javiereguiluz added a commit that referenced this pull request Feb 24, 2018
…Landauer)

This PR was squashed before being merged into the 2.7 branch (closes #9259).

Discussion
----------

Explaining the "one-to-many" case more explicitly

Please double-check: I'm not certain if "For a many-to-many relationship:" (line 574) is correct!

Commits
-------

5636b52 Explaining the "one-to-many" case more explicitly
@ThomasLandauer ThomasLandauer deleted the patch-12 branch February 24, 2018 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants