src/Graviton/RestBundle/Model/DocumentModel.php
public function getSerialised($documentId, Request $request = null)
    {
        if (is_null($request)) {
            $request = Request::create('');
        }

        $request->attributes->set('singleDocument', $documentId);

        $document = $this->queryService->getWithRequest($request, $this->repository);
        if (empty($document)) {
            throw new NotFoundException(
                sprintf(
                    "Entry with id '%s' not found!",
                    $documentId
                )
            );
        }

        return $this->restUtils->serialize($document);
    }
public function getSerialised($documentId, Request $request = null)
    {
        if (is_null($request)) {
            $request = Request::create('');
        }

        $request->attributes->set('singleDocument', $documentId);

        $document = $this->queryService->getWithRequest($request, $this->repository);
        if (empty($document)) {
            throw new NotFoundException(
                sprintf(
                    "Entry with id '%s' not found!",
                    $documentId
                )
            );
        }

        return $this->restUtils->serialize($document);
    }
public function getSerialised ( $ documentId , Request $ request = null ) { if ( is_null ( $ request ) ) { $ request = Request :: create ( '' ) ; } $ request -> attributes -> set ( 'singleDocument' , $ documentId ) ; $ document = $ this -> queryService -> getWithRequest ( $ request , $ this -> repository ) ; if ( empty ( $ document ) ) { throw new NotFoundException ( sprintf ( "Entry with id '%s' not found!" , $ documentId ) ) ; } return $ this -> restUtils -> serialize ( $ document ) ; }
Will attempt to find Document by ID.
If config cache is enabled for document it will save it.

@param string  $documentId id of entity to find
@param Request $request    request

@throws NotFoundException
@return string Serialised object
Will attempt to find Document by ID . If config cache is enabled for document it will save it .