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

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

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

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

@param object $entity The entity to serialize

@return string The entity serialized in JSON-LD

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