src/Graviton/RestBundle/Service/RestUtils.php
public function serializeContent($content, $format = 'json')
    {
        try {
            return $this->getSerializer()->serialize(
                $content,
                $format
            );
        } catch (\Exception $e) {
            $msg = sprintf(
                'Cannot serialize content class: %s; with id: %s; Message: %s',
                get_class($content),
                method_exists($content, 'getId') ? $content->getId() : '-no id-',
                str_replace('MongoDBODMProxies\__CG__\GravitonDyn', '', $e->getMessage())
            );
            $this->logger->alert($msg);
            throw new \Exception($msg, $e->getCode());
        }
    }
public function serializeContent($content, $format = 'json')
    {
        try {
            return $this->getSerializer()->serialize(
                $content,
                $format
            );
        } catch (\Exception $e) {
            $msg = sprintf(
                'Cannot serialize content class: %s; with id: %s; Message: %s',
                get_class($content),
                method_exists($content, 'getId') ? $content->getId() : '-no id-',
                str_replace('MongoDBODMProxies\__CG__\GravitonDyn', '', $e->getMessage())
            );
            $this->logger->alert($msg);
            throw new \Exception($msg, $e->getCode());
        }
    }
public function serializeContent ( $ content , $ format = 'json' ) { try { return $ this -> getSerializer ( ) -> serialize ( $ content , $ format ) ; } catch ( \ Exception $ e ) { $ msg = sprintf ( 'Cannot serialize content class: %s; with id: %s; Message: %s' , get_class ( $ content ) , method_exists ( $ content , 'getId' ) ? $ content -> getId ( ) : '-no id-' , str_replace ( 'MongoDBODMProxies\__CG__\GravitonDyn' , '' , $ e -> getMessage ( ) ) ) ; $ this -> logger -> alert ( $ msg ) ; throw new \ Exception ( $ msg , $ e -> getCode ( ) ) ; } }
Public function to serialize stuff according to the serializer rules.

@param object $content Any content to serialize
@param string $format  Which format to serialize into

@throws \Exception

@return string $content Json content
Public function to serialize stuff according to the serializer rules .