Inheritance: implements Neos\Flow\Persistence\PersistenceManagerInterface
 /**
  * @test
  */
 public function convertObjectsToIdentityArraysConvertsObjectsInIterators()
 {
     $object1 = new \stdClass();
     $object2 = new \stdClass();
     $this->abstractPersistenceManager->expects($this->at(0))->method('getIdentifierByObject')->with($object1)->will($this->returnValue('identifier1'));
     $this->abstractPersistenceManager->expects($this->at(1))->method('getIdentifierByObject')->with($object2)->will($this->returnValue('identifier2'));
     $originalArray = ['foo' => 'bar', 'object1' => $object1, 'baz' => new \ArrayObject(['object2' => $object2])];
     $expectedResult = ['foo' => 'bar', 'object1' => ['__identity' => 'identifier1'], 'baz' => ['object2' => ['__identity' => 'identifier2']]];
     $actualResult = $this->abstractPersistenceManager->convertObjectsToIdentityArrays($originalArray);
     $this->assertEquals($expectedResult, $actualResult);
 }
 /**
  * Clears the in-memory state of the persistence.
  *
  * Managed instances become detached, any fetches will
  * return data directly from the persistence "backend".
  *
  * @return void
  */
 public function clearState()
 {
     parent::clearState();
     $this->entityManager->clear();
 }
示例#3
0
 /**
  * Clears the in-memory state of the persistence.
  *
  * Managed instances become detached, any fetches will
  * return data directly from the persistence "backend".
  * It will also forget about new objects.
  *
  * @return void
  */
 public function clearState()
 {
     parent::clearState();
     $this->addedObjects = new \SplObjectStorage();
     $this->removedObjects = new \SplObjectStorage();
     $this->changedObjects = new \SplObjectStorage();
     $this->persistenceSession->destroy();
     $this->hasUnpersistedChanges = false;
 }