Created
December 3, 2014 19:29
-
-
Save blockjon/de5088b8ec34b7e7cf1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get a detached document from cache | |
$someDude = ....; // Pull a detached document from the cache with name "John" | |
// Use the postupdate annotation feature to trigger a call to sayMyName() | |
// which simply echo's this persons name to stdout. | |
$someDude->queuePostUpdateEvent( | |
$someDude, | |
'sayMyName', | |
array() | |
); | |
// Get the managed version of this document | |
$mergedDocument = $documentManager->merge($someDude); | |
// Set the person's name to santa claus. | |
$mergedDocument->setFirstName("Santa Claus"); | |
// Capture the output of what sayMyName() echos out | |
ob_start(); | |
$documentManager->flush($mergedDocument); | |
$output = ob_get_clean(); | |
$this->assertEquals("John", $output); // <- Returns true | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment