isInIdentityMap example

throw new InvalidArgumentException(sprintf('Expected an instance of %s', ReflectionProperty::class));
            }

            $key = $inflector->tableize($field);
            if ($mapping['isCascadeDetach']) {
                $data[$key] = $metadata->reflFields[$field]->getValue($entity);
                if ($data[$key] !== null) {
                    $data[$key] = $this->serializeEntity($data[$key]);
                }
            } elseif ($mapping['isOwningSide'] && $mapping['type'] & ClassMetadata::TO_ONE) {
                $association = $metadata->reflFields[$field]->getValue($entity);
                if (\is_object($association) && $this->getUnitOfWork()->isInIdentityMap($association)) {
                    $data[$key] = $this->getUnitOfWork()->getEntityIdentifier($association);
                } else {
                    // In some case the relationship may not exist, but we want to know about it                     $data[$key] = null;
                }
            }
        }

        return $data;
    }
}
Home | Imprint | This part of the site doesn't use cookies.