Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Refactored docs to use adders/removers#2434

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
weaverryan merged 1 commit intosymfony:2.1fromwouterj:add_remove
May 3, 2013

Conversation

@wouterj
Copy link
Member

QA
Doc fix?yes
New docs?yes
Applies to2.1+
Fixed tickets#1057

This is the first draw to fix this document for 2.1. I have not tested the code yet, that's why I called it a WIP.

@wouterj
Copy link
MemberAuthor

The code is tested on 2.1 and it works.

I have one question though. There is a note that says:

First, unless you iterate over all of the newTag objects and
call$em->persist($tag) on each, you'll receive an error from
Doctrine:

A new entity was found through the relationship
Acme\TaskBundle\Entity\Task#tags that was not configured to
cascade persist operations for entity...

I tested it with Doctrine 2.3.1 and I got no error.

@stof
Copy link
Member

stof commentedApr 6, 2013

@wouterj Are you adding new elements in the collection or only editing exsting ones ?

@stof
Copy link
Member

stof commentedApr 6, 2013

And are you cascading the persist on the relation ? If yes, it is indeed useless to persist explicitly each tag

Copy link
Member

Choose a reason for hiding this comment

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

You need to define bothaddTag andremoveTag. If one of them is missing, the setter for the collection will be used when usingby_reference => false, not the adder and remover for each element

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

fixed

@weaverryan
Copy link
Member

Ping@wouterj! I'm waiting for answers on Stof's questions before moving on :)

@wouterj
Copy link
MemberAuthor

Sorry for my delay on this. I need to finish some PRs now! :)

@stof was correct, the entity I used was cascading the persist action. (I just used your entity, so I wasn't aware of that)

@wouterj
Copy link
MemberAuthor

@weaverryan I've updated the article, I think it's ready now

weaverryan added a commit that referenced this pull requestMay 3, 2013
Refactored docs to use adders/removers
@weaverryanweaverryan merged commite9b063c intosymfony:2.1May 3, 2013
weaverryan added a commit that referenced this pull requestMay 3, 2013
@weaverryan
Copy link
Member

Nice work@wouter - I moved the new text further down in the article, but I have very few changes otherwise.

Tweaks at sha:ec49d58

Thanks!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@wouterj@stof@weaverryan

[8]ページ先頭

©2009-2025 Movatter.jp