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

Unexpected result when deleted embedded collections #158

Closed
AlexKa opened this issue Sep 18, 2011 · 3 comments
Closed

Unexpected result when deleted embedded collections #158

AlexKa opened this issue Sep 18, 2011 · 3 comments

Comments

@AlexKa
Copy link

AlexKa commented Sep 18, 2011

Scenario: Before deleting an embedded collection, the original collection shall be backuped.

The script is listening for the onFlush Event.

For Updates this works fine:

foreach ($uow->getScheduledCollectionUpdates() AS $col) {
    $col->getSnapshot(); # gives me the original collection -> works as expected
}

However this does not work for Deletions:

foreach ($uow->getScheduledCollectionDeletions() AS $col) {
    $col->getSnapshot(); # is allways empty. -> does NOT work as expected

    # Also empty (which I consider to be really strange: as OriginalDocumentData is documented as "The original data is the data that was present at the time the document was reconstituted from the database"):

    $org = $uow->getOriginalDocumentData( $col->getOwner() );
    $mapping = $col->getMapping();
    $org[$mapping["fieldName"]]; # empty; but it should have the original collection, which is going to be deleted
}

Any Ideas?

@AlexKa
Copy link
Author

AlexKa commented Oct 4, 2011

Hmm, with the current github version (updated today), Embedded Object also do not work anymore...

// $document contains Embedded Object

$changeSet = $uow->getDocumentChangeSet($document);

foreach($changeSet as $key => $change){
var_dump($change);exit;
}

// [0] == [1] 

// => you cannot get the old object

@AlexKa AlexKa closed this as completed Oct 4, 2011
@AlexKa AlexKa reopened this Oct 4, 2011
@jwage
Copy link
Member

jwage commented Feb 7, 2012

Hi can you provide a test in phpunit against the latest github version? I am trying but I cannot reproduce.

@jwage jwage closed this as completed Feb 7, 2012
@AlexKa
Copy link
Author

AlexKa commented Feb 23, 2012

I'm still on old version... when I'll update, I'll test again and write a test..

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

No branches or pull requests

2 participants