/**
  * Tries to find an entity with the given identifier in the identity map of
  * this UnitOfWork.
  *
  * @param mixed  $id            The entity identifier to look for.
  * @param string $rootClassName The name of the root class of the mapped entity hierarchy.
  *
  * @return object|bool Returns the entity with the specified identifier if it exists in
  *                     this UnitOfWork, FALSE otherwise.
  */
 public function tryGetById($id, $rootClassName)
 {
     /** @var EntityMetadata $metadata */
     $metadata = $this->manager->getClassMetadata($rootClassName);
     $idHash = implode(' ', (array) $this->identifierFlattener->flattenIdentifier($metadata, $id));
     if (isset($this->identityMap[$rootClassName][$idHash])) {
         return $this->identityMap[$rootClassName][$idHash];
     }
     return false;
 }
 /**
  * Returns key for entity
  *
  * @param ApiMetadata $metadata
  * @param array       $identifiers
  *
  * @return mixed
  */
 protected function getEntityKey(ApiMetadata $metadata, array $identifiers)
 {
     $flattenIdentifiers = $this->idFlattener->flattenIdentifier($metadata, $identifiers);
     return sprintf('%s %s', $metadata->getName(), implode(' ', $flattenIdentifiers));
 }