/**
  * {@inheritDoc}
  */
 public function load($object, $group)
 {
     $class = get_class($object);
     $key = 'object_mapper:' . $class . ':' . $group;
     $metadata = $this->cache->get($key);
     if (!$metadata) {
         $metadata = $this->delegate->load($object, $group);
         $this->cache->set($key, $metadata);
     }
     return $metadata;
 }
 /**
  * Map process
  *
  * @param object         $object
  * @param array          $parameters
  * @param string         $group
  * @param array          $paths
  *
  * @return object
  *
  * @throws MapException
  * @throws ObjectNotSupportedException
  */
 protected function doMap($object, array $parameters, $group, array $paths)
 {
     if (!is_object($object)) {
         throw UnexpectedTypeException::create($object, 'object');
     }
     $metadata = $this->metadataFactory->load($object, $group);
     if (!$metadata) {
         throw new ObjectNotSupportedException(sprintf('The object with class "%s" not supported for mapping in group "%s".', get_class($object), $group));
     }
     $strategy = $this->strategyManager->getStrategy($metadata->getStrategy());
     foreach ($metadata->getProperties() as $propertyMetadata) {
         if (!isset($parameters[$propertyMetadata->getFieldName()])) {
             // Not found parameter for property
             continue;
         }
         // Add path name to paths stack
         $paths[] = $propertyMetadata->getFieldName();
         $value = $parameters[$propertyMetadata->getFieldName()];
         if ($propertyMetadata->getCollectionMetadata()) {
             // Map as new collection
             $value = $this->doMapCollection($propertyMetadata, $value, $group, $paths);
         } else {
             if ($propertyMetadata->getClass()) {
                 // Map as new model
                 $value = $this->doMapNewObject($propertyMetadata, $value, $group, $paths);
             }
         }
         $strategy->map($propertyMetadata, $object, $value);
         // Pop path name from paths stack
         array_pop($paths);
     }
     return $object;
 }