public function read($id)
    {
        $class = $this->getEntityClassFromType($this->apiRecordType);
        $entity = $this->getEntityManager()->find($class, $id);

        if (!$entity) {
            return new Response('', Response::HTTP_NOT_FOUND);
        }

        return new JsonResponse($this->getApiWriter()->writeObject($entity), Response::HTTP_CREATED);
    }
public function read($id)
    {
        $class = $this->getEntityClassFromType($this->apiRecordType);
        $entity = $this->getEntityManager()->find($class, $id);

        if (!$entity) {
            return new Response('', Response::HTTP_NOT_FOUND);
        }

        return new JsonResponse($this->getApiWriter()->writeObject($entity), Response::HTTP_CREATED);
    }
public function read ( $ id ) { $ class = $ this -> getEntityClassFromType ( $ this -> apiRecordType ) ; $ entity = $ this -> getEntityManager ( ) -> find ( $ class , $ id ) ; if ( ! $ entity ) { return new Response ( '' , Response :: HTTP_NOT_FOUND ) ; } return new JsonResponse ( $ this -> getApiWriter ( ) -> writeObject ( $ entity ) , Response :: HTTP_CREATED ) ; }
Note that route must be set up to include an id parameter

@param $id
@return JsonResponse|Response
@internal param Request $request
Note that route must be set up to include an id parameter