em = $entityManager; } public function getEntity($entity, $id) { if($entity == 'product'){ $repo = $this->em->getRepository(ProductInterface::class); $data = $repo->find($id); $data= array( 'id' => $data->getId(), 'title' => $data->getTitleInherited(), 'price' => $data->getPriceInherited(), 'unit' => $data->getUnitInherited(), 'availableQuantity' => $data->getAvailableQuantityInherited(), 'taxRate' => $data->getTaxRateInherited(), ); } return new JsonResponse($data); } }