private function Flow_serializeRelatedEntities(array $transientProperties, array $propertyVarTags)
{
$reflectedClass = new \ReflectionClass(__CLASS__);
$allReflectedProperties = $reflectedClass->getProperties();
foreach ($allReflectedProperties as $reflectionProperty) {
$propertyName = $reflectionProperty->name;
if (in_array($propertyName, ['Flow_Aop_Proxy_targetMethodsAndGroupedAdvices', 'Flow_Aop_Proxy_groupedAdviceChains', 'Flow_Aop_Proxy_methodIsInAdviceMode'])) {
continue;
}
if (isset($this->Flow_Injected_Properties) && is_array($this->Flow_Injected_Properties) && in_array($propertyName, $this->Flow_Injected_Properties)) {
continue;
}
if ($reflectionProperty->isStatic() || in_array($propertyName, $transientProperties)) {
continue;
}
if (is_array($this->{$propertyName}) || is_object($this->{$propertyName}) && ($this->{$propertyName} instanceof \ArrayObject || $this->{$propertyName} instanceof \SplObjectStorage || $this->{$propertyName} instanceof Collection)) {
if (count($this->{$propertyName}) > 0) {
foreach ($this->{$propertyName} as $key => $value) {
$this->Flow_searchForEntitiesAndStoreIdentifierArray((string) $key, $value, $propertyName);
}
}
}
if (is_object($this->{$propertyName}) && !$this->{$propertyName} instanceof Collection) {
if ($this->{$propertyName} instanceof OrmProxy) {
$className = get_parent_class($this->{$propertyName});
} else {
if (isset($propertyVarTags[$propertyName])) {
$className = trim($propertyVarTags[$propertyName], '\\');
}
if (Bootstrap::$staticObjectManager->isRegistered($className) === false) {
$className = Bootstrap::$staticObjectManager->getObjectNameByClassName(get_class($this->{$propertyName}));
}
}
if ($this->{$propertyName} instanceof PersistenceMagicInterface && !Bootstrap::$staticObjectManager->get(PersistenceManagerInterface::class)->isNewObject($this->{$propertyName}) || $this->{$propertyName} instanceof OrmProxy) {
if (!property_exists($this, 'Flow_Persistence_RelatedEntities') || !is_array($this->Flow_Persistence_RelatedEntities)) {
$this->Flow_Persistence_RelatedEntities = [];
$this->Flow_Object_PropertiesToSerialize[] = 'Flow_Persistence_RelatedEntities';
}
$identifier = Bootstrap::$staticObjectManager->get(PersistenceManagerInterface::class)->getIdentifierByObject($this->{$propertyName});
if (!$identifier && $this->{$propertyName} instanceof OrmProxy) {
$identifier = current(ObjectAccess::getProperty($this->{$propertyName}, '_identifier', true));
}
$this->Flow_Persistence_RelatedEntities[$propertyName] = ['propertyName' => $propertyName, 'entityType' => $className, 'identifier' => $identifier];
continue;
}
if ($className !== false && (Bootstrap::$staticObjectManager->getScope($className) === Configuration::SCOPE_SINGLETON || $className === DependencyProxy::class)) {
continue;
}
}
$this->Flow_Object_PropertiesToSerialize[] = $propertyName;
}
return $this->Flow_Object_PropertiesToSerialize;
}