/**
  * {@inheritdoc}
  */
 public function reverseTransform($keys)
 {
     if (!is_array($keys)) {
         throw new UnexpectedTypeException($keys, 'array');
     }
     $collection = $this->modelManager->getModelCollectionInstance($this->class);
     $notFound = array();
     // optimize this into a SELECT WHERE IN query
     foreach ($keys as $key) {
         if ($entity = $this->modelManager->find($this->class, $key)) {
             $collection[] = $entity;
         } else {
             $notFound[] = $key;
         }
     }
     if (count($notFound) > 0) {
         throw new TransformationFailedException(sprintf('The entities with keys "%s" could not be found', implode('", "', $notFound)));
     }
     return $collection;
 }
 /**
  * {@inheritdoc}
  */
 public function reverseTransform($value)
 {
     $collection = $this->modelManager->getModelCollectionInstance($this->className);
     if (empty($value)) {
         if ($this->multiple) {
             return $collection;
         }
         return;
     }
     if (!$this->multiple) {
         return $this->modelManager->find($this->className, $value);
     }
     if (!is_array($value)) {
         throw new \UnexpectedValueException(sprintf('Value should be array, %s given.', gettype($value)));
     }
     foreach ($value as $key => $id) {
         if ($key === '_labels') {
             continue;
         }
         $collection->add($this->modelManager->find($this->className, $id));
     }
     return $collection;
 }