lib/Webforge/ProjectStack/Symfony/Form/Transformer/DoctrineEntityTransformer.php
public function reverseTransform($properties) {
    if (!is_array($properties)) {
      return NULL;
    }

    if (!isset($properties[$this->identifierName])) {
      throw new TransformationFailedException(sprintf(
        'Identifier (%s) for entity %s is not set in properties %s',
        $this->identifierName,
        $this->entityClass,
        json_encode($properties, JSON_PRETTY_PRINT)
      ));
    }

    $identifier = $properties[$this->identifierName];

    $entity = $this->om
      ->getRepository($this->entityClass)
      ->findOneBy(array($this->identifierName => $identifier))
    ;

    if (!($entity instanceof $this->entityClass)) {
      throw new TransformationFailedException(sprintf(
        'Entity %s with identifier (%s) "%s" cannot be found',
        $this->entityClass,
        $this->identifierName,
        $identifier
      ));
    }

    return $entity;
  }
public function reverseTransform($properties) {
    if (!is_array($properties)) {
      return NULL;
    }

    if (!isset($properties[$this->identifierName])) {
      throw new TransformationFailedException(sprintf(
        'Identifier (%s) for entity %s is not set in properties %s',
        $this->identifierName,
        $this->entityClass,
        json_encode($properties, JSON_PRETTY_PRINT)
      ));
    }

    $identifier = $properties[$this->identifierName];

    $entity = $this->om
      ->getRepository($this->entityClass)
      ->findOneBy(array($this->identifierName => $identifier))
    ;

    if (!($entity instanceof $this->entityClass)) {
      throw new TransformationFailedException(sprintf(
        'Entity %s with identifier (%s) "%s" cannot be found',
        $this->entityClass,
        $this->identifierName,
        $identifier
      ));
    }

    return $entity;
  }
public function reverseTransform ( $ properties ) { if ( ! is_array ( $ properties ) ) { return NULL ; } if ( ! isset ( $ properties [ $ this -> identifierName ] ) ) { throw new TransformationFailedException ( sprintf ( 'Identifier (%s) for entity %s is not set in properties %s' , $ this -> identifierName , $ this -> entityClass , json_encode ( $ properties , JSON_PRETTY_PRINT ) ) ) ; } $ identifier = $ properties [ $ this -> identifierName ] ; $ entity = $ this -> om -> getRepository ( $ this -> entityClass ) -> findOneBy ( array ( $ this -> identifierName => $ identifier ) ) ; if ( ! ( $ entity instanceof $ this -> entityClass ) ) { throw new TransformationFailedException ( sprintf ( 'Entity %s with identifier (%s) "%s" cannot be found' , $ this -> entityClass , $ this -> identifierName , $ identifier ) ) ; } return $ entity ; }
Transforms an json object to an entity
Transforms an json object to an entity