public function convertObjectToIdentityArray($object) { $identifier = $this->getIdentifierByObject($object); if ($identifier === null) { throw new Exception\UnknownObjectException(sprintf('Tried to convert an object of type "%s" to an identity array, but it is unknown to the Persistence Manager.', get_class($object)), 1302628242); } return ['__identity' => $identifier]; }
/** * @test * @expectedException \Neos\Flow\Persistence\Exception\UnknownObjectException */ public function convertObjectToIdentityArrayThrowsExceptionIfIdentityForTheGivenObjectCantBeDetermined() { $someObject = new \stdClass(); $this->abstractPersistenceManager->expects($this->once())->method('getIdentifierByObject')->with($someObject)->will($this->returnValue(null)); $this->abstractPersistenceManager->convertObjectToIdentityArray($someObject); }