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

[DDC-3160] Alternate fix for DDC-2996 bug #1074

Merged
merged 3 commits into from
Jul 6, 2014
Merged

[DDC-3160] Alternate fix for DDC-2996 bug #1074

merged 3 commits into from
Jul 6, 2014

Conversation

zimmermanj42
Copy link
Contributor

The fix implemented for DDC-2996 seems to have broken quite a bit of code outside of Doctrine (for instance, the popular DoctrineExtensions project).

I'm not too well versed in Doctrine internals, but looking at the fix, I found it odd that an entity would live in both the insertion and update tracking in the unit of work.

This implementation should fix the case described in DDC-2996, while not creating any side effects with objects that are scheduled to be inserted.

I've ran this test with the Doctrine test suite and have also tested this change with the DoctrineExtensions project; unless I'm doing something wrong, it seems to have good results.

Again, I'm not too well versed in the inner workings of Doctrine, but I did a little research, poked around some code, and came up with this.

@zimmermanj42
Copy link
Contributor Author

To be more specific, I really only tested the Tree features of the DoctrineExtensions project with this fix.

@zimmermanj42
Copy link
Contributor Author

Just tried the fix with the full test suite of DoctrineExtensions, and it seemed to report OK.

@stof
Copy link
Member

stof commented Jun 26, 2014

👍 and this should be backported to 2.4 (and released as 2.4.4) as 2.4.3 is currently broken, while required to use latest PHP versions

@kbond
Copy link
Contributor

kbond commented Jun 26, 2014

Nice work! +1 for backporting to 2.4.

@cmfcmf
Copy link

cmfcmf commented Jul 1, 2014

Would be awesome to make DoctrineExtensions::Tree work again! ⭐ ⛵ 🍎 💾

@Filoz
Copy link

Filoz commented Jul 3, 2014

👍

@stloyd
Copy link
Contributor

stloyd commented Jul 3, 2014

👍, without this we can't update Sylius to use latest stable Doctrine -.-

@Ocramius
Copy link
Member

Ocramius commented Jul 3, 2014

I'd still ask for a test case to avoid regressions.

@Ocramius Ocramius self-assigned this Jul 3, 2014
@ecoleman
Copy link

ecoleman commented Jul 3, 2014

👍

1 similar comment
@nicwortel
Copy link
Contributor

👍

@guilhermeblanco
Copy link
Member

👎 until we see a test... =\

@zimmermanj42
Copy link
Contributor Author

Another user already put together a test for DDC-3160. It is currently a pull request:

#1057

Should I make another? I looked over the test and it appears to me to be good. Before this fix, the test failed and now it passes.

There should already be a test for DDC-2996 that is still passing with this fix:

8b75e35

@stof
Copy link
Member

stof commented Jul 4, 2014

you should rebase your branch on top of his commit, so that the test gets included in your PR (but preserving authorship)

@zimmermanj42
Copy link
Contributor Author

I just merged the test created by @flack into this pull request.

}
}

class OnFlushListener
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like there is already an OnFlushListener in DDC2790Test.php causing an error.

Copy link
Member

Choose a reason for hiding this comment

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

Always prefix with ticket number... DDC3160OnFlushListener

A fix for DDC-2996 was implemented that broke quite a few extensions.

This commit is an attempt to fix the DDC-2996 bug without the adverse side effects seen in DDC-3160.

Basically, if changes are detected that would cause a changeset to be made, but the entity is awaiting insertion, the code will not save the changeset nor flag the entity as awaiting updating in the Unit of Work.

Some styling tweaks based on Pull Request guidelines.
@zimmermanj42
Copy link
Contributor Author

Ok, I think I've got it situated better now (just starting to work with Git and not too knowledgeable of it yet).

Based on the feedback from @stof, I've got this branch rebased on the commit by @flack for the DDC-3160 test. I have also fixed up a few issues with that test.

The DDC-2996 and the DDC-3160 tests are passing (tried them individually with PHPUnit) along with all the other tests. It also appears that the Travis CI build is passing as well.

@Ocramius
Copy link
Member

Ocramius commented Jul 6, 2014

@jmikola can you check if this behavior was also broken in the ODM? May want to backport the tests into the MongoDB ODM as well.

@dbu maybe you can check PHPCR-ODM?

@Ocramius
Copy link
Member

Ocramius commented Jul 6, 2014

This looks good to me. I'm merging into master, so please check it in your local applications with the latest ORM. If the fix actually works for Gedmo, then we'll backport to 2.4.x

Ocramius added a commit that referenced this pull request Jul 6, 2014
[DDC-3160] Alternate fix for DDC-2996 bug
@Ocramius Ocramius merged commit a8035f2 into doctrine:master Jul 6, 2014
@Ocramius
Copy link
Member

Ocramius commented Jul 6, 2014

Please report any feedback on this fix at http://www.doctrine-project.org/jira/browse/DDC-3208

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.