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

NOTIFY change tracking policy fixes #1257

Merged
merged 3 commits into from
Oct 30, 2015
Merged

NOTIFY change tracking policy fixes #1257

merged 3 commits into from
Oct 30, 2015

Conversation

rbrtbn
Copy link
Contributor

@rbrtbn rbrtbn commented Oct 29, 2015

This PR fixes some issues with documents using the NOTIFY change tracking policy, namely:

  • Committing a document of this kind multiple times raised an Undefined index notice as reported in [UOW] Only get change set from documentChangeSets if it exists. #740. Fixed the error and created a test case for it.
  • Committing only a single document made the UnitOfWork lose changes of all other managed documents with NOTIFY change tracking policy. Fixed this too and also created a test case for it.
  • Additionally I found that the current test case for the this change tracking policy (namely: UnitOfWorkTest::testChangeTrackingNotify) used a document without the required @ODM\ChangeTrackingPolicy("NOTIFY") annotation as its test subject, so the test didn't test what it supposed to test. I added the missing annotation to this dummy document.

@rbrtbn rbrtbn changed the title NOTIFY change tracking fixes NOTIFY change tracking policy fixes Oct 29, 2015
@malarzm
Copy link
Member

malarzm commented Oct 29, 2015

@banrobert thank you for PR! Before I get to review could you please take a look at failing test on Travis?

@malarzm malarzm added the Bug label Oct 29, 2015
@malarzm malarzm added this to the 1.0.x milestone Oct 29, 2015
@rbrtbn
Copy link
Contributor Author

rbrtbn commented Oct 29, 2015

Updated the test case that failed previously, it should work now.

The unit tests now passed on Travis CI, but the Scrutinizer has timed out. Maybe a retry would help?

unset($this->documentChangeSets[$oid]);
unset($this->scheduledForDirtyCheck[$class->name][$oid]);
} elseif (is_array($document)) {
foreach ($document as $object) {
Copy link
Member

Choose a reason for hiding this comment

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

This will not be enough as inserted documents should have their change sets cleared as well (and embedded documents that were committed etc), see #1149

Copy link
Member

Choose a reason for hiding this comment

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

Having said that I think the PR will be better without this at all and instead we should work on #1149 for 1.x

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You might be right. Until a decision is made on #1149 it's not certain that this fix is what needed here and as you said it's not even complete. I'll remove this from the PR.

@malarzm malarzm modified the milestones: 1.0.3, 1.0.x Oct 30, 2015
@malarzm
Copy link
Member

malarzm commented Oct 30, 2015

@banrobert cool thanks, could you remove that two commits (434045a and 0d06d66) at all? Once that is done PR's good to be merged.

As for #1149 I'll poke rest of the team for thoughts, FWIW I think it does make sense to implement it.

…ror_get_last() for catching an E_NOTICE error
@rbrtbn
Copy link
Contributor Author

rbrtbn commented Oct 30, 2015

Removed the commits, never rebased before, didn't know this was possible, cool feature.

And regarding #1149 i would also say that implementing the single document flush differently than the ORM but making it clearer by not flushing anything else that is not related to the document in question is the way to go. Hope the team agrees!

malarzm added a commit that referenced this pull request Oct 30, 2015
NOTIFY change tracking policy fixes
@malarzm malarzm merged commit 5803418 into doctrine:master Oct 30, 2015
@malarzm
Copy link
Member

malarzm commented Oct 30, 2015

Merged, thank you @banrobert!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants