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

Invalid state when node is deleted in a different session. #323

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from

Conversation

dantleech
Copy link
Contributor

We have encountered problems with the new DoctrinePHPCRBundle when it shuts down the kernel. It calls "clean" on the document manager and then logs out of the session(s).

The problem is that calling "clean" invokes a refresh(false) and in our test cases it may be that some of the nodes managed in the current kernel have been deleted from storage in another, so our system explodes with:

PHPCR\InvalidItemStateException: Item /article is deleted

when the kernel is shutdown.

I think that in this case nodes should be de-registered (and so accessing them would throw a "node deleted" error) -

if you refresh($keepChanges = false) and this is the case, it means that you may encounter this error later rather than sooner (mostly never) - not sure if that is better or worse tbh.

We could also address this in the Bundle somehow.

@dantleech
Copy link
Contributor Author

Looking at the Doctrine ORM, it seems if I perstist an Entity, delete it directy from the database, then refresh it - nothing happens and it is still "managed" If I then re-persist it, it is not persisted. Strange ..

$this->session->refresh(false);

// throws PathNotFoundException
$article->getProperty('foo');
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 expected behaviour. the node was deleted so accessing the property should throw an exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indeed, I was just checking what would happen.

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.

2 participants