protected function convertObjectTo(ValueObject $object, $type)
    {
        $type = strtolower($type);
        switch ($type) {
            case 'json':
            case 'xml':
                $visitor = $this->getKernel()->getContainer()->get('ezpublish_rest.output.visitor.' . $type);
                break;

            default:
                throw new InvalidArgumentException('rest body type', $type);
        }

        return $visitor->visit($object);
    }
protected function convertObjectTo(ValueObject $object, $type)
    {
        $type = strtolower($type);
        switch ($type) {
            case 'json':
            case 'xml':
                $visitor = $this->getKernel()->getContainer()->get('ezpublish_rest.output.visitor.' . $type);
                break;

            default:
                throw new InvalidArgumentException('rest body type', $type);
        }

        return $visitor->visit($object);
    }
protected function convertObjectTo ( ValueObject $ object , $ type ) { $ type = strtolower ( $ type ) ; switch ( $ type ) { case 'json' : case 'xml' : $ visitor = $ this -> getKernel ( ) -> getContainer ( ) -> get ( 'ezpublish_rest.output.visitor.' . $ type ) ; break ; default : throw new InvalidArgumentException ( 'rest body type' , $ type ) ; } return $ visitor -> visit ( $ object ) ; }
Convert an object to a request.

@param \eZ\Publish\API\Repository\Values\ValueObject $object Object to be converted
@param string $type Type for conversion

@return \Symfony\Component\HttpFoundation\Response

@throws InvalidArgumentException If the type is not known
Convert an object to a request .