public function deserialize($data, $entity)
    {
        if (!$this->container->has('hydra.serializer')) {
            throw new \LogicException('The HydraBundle is not registered in your application.');
        }

        $serializer = $this->container->get('hydra.serializer');

        if (is_object($entity)) {
            return $serializer->deserializeIntoEntity($data, $entity);
        }

        return $serializer->deserialize($data, $entity, self::FORMAT);
    }
public function deserialize($data, $entity)
    {
        if (!$this->container->has('hydra.serializer')) {
            throw new \LogicException('The HydraBundle is not registered in your application.');
        }

        $serializer = $this->container->get('hydra.serializer');

        if (is_object($entity)) {
            return $serializer->deserializeIntoEntity($data, $entity);
        }

        return $serializer->deserialize($data, $entity, self::FORMAT);
    }
public function deserialize ( $ data , $ entity ) { if ( ! $ this -> container -> has ( 'hydra.serializer' ) ) { throw new \ LogicException ( 'The HydraBundle is not registered in your application.' ) ; } $ serializer = $ this -> container -> get ( 'hydra.serializer' ) ; if ( is_object ( $ entity ) ) { return $ serializer -> deserializeIntoEntity ( $ data , $ entity ) ; } return $ serializer -> deserialize ( $ data , $ entity , self :: FORMAT ) ; }
Shortcut to deserialize JSON-LD data to an entity

This method uses the Hydra Serializer service and therefore requires
that the HydraBundle is registered.

@param string        $data   The data to deserialize
@param string|object $entity The class or an instance thereof the data
should be deserialized to.

@return object The deserialized entity

@throws \LogicException If HydraBundle is not available
Shortcut to deserialize JSON - LD data to an entity