/**
* Fetches the identifier from the set content object. If that
* is not using automatically introduced UUIDs by Flow it tries
* to call persistAll() and fetch the identifier again. If it still
* fails, an exception is thrown.
*
* @return void
* @throws IllegalObjectTypeException
*/
protected function initializeObject()
{
if ($this->contentObject !== null) {
$this->targetType = get_class($this->contentObject);
$this->targetId = $this->persistenceManager->getIdentifierByObject($this->contentObject);
if ($this->targetId === null) {
$this->persistenceManager->persistAll();
$this->targetId = $this->persistenceManager->getIdentifierByObject($this->contentObject);
if ($this->targetId === null) {
throw new IllegalObjectTypeException('You cannot add an object without an identifier to a ContentObjectProxy. Probably you didn\'t add a valid entity?', 1303859434);
}
}
}
}