src/Karika/CoreBundle/Controller/Api/ApiController.php
public function getAction(int $id)
    {
        try {
            $em = $this->getDoctrine()->getManager();
            $entity = $em->getRepository($this->entityClassName())->find($id);
            if ($entity) {
                return $entity;
            }
            return FOSView::create('Not Found', Response::HTTP_NO_CONTENT);
        } catch (\Exception $e) {
            return FOSView::create($e->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
        }
    }
public function getAction(int $id)
    {
        try {
            $em = $this->getDoctrine()->getManager();
            $entity = $em->getRepository($this->entityClassName())->find($id);
            if ($entity) {
                return $entity;
            }
            return FOSView::create('Not Found', Response::HTTP_NO_CONTENT);
        } catch (\Exception $e) {
            return FOSView::create($e->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
        }
    }
Get a Product entity

@ApiDoc

@View(serializerEnableMaxDepthChecks=true)

@param int $id

@return FOSView|object