em = $entityManager; $this->priceUtils = $priceUtils; $this->productFamilyUtils = $productFamilyUtils; } public function getEntity($entity, $id) { $repo = $this->em->getRepository(ProductCategoryInterface::class); $data = $repo->findBy(array()); if($entity == 'product'){ $repo = $this->em->getRepository(ProductInterface::class); $data = $repo->find($id); $data= array( 'id' => $data->getId(), 'title' => $data->getTitleInherited(), 'price' => $this->priceUtils->getPrice($data), 'priceWithTax' => $this->priceUtils->getPriceWithTax($data), 'priceWithTaxAndReduction' => $this->priceUtils->getPriceWithTaxAndReduction($data), 'unit' => $data->getUnitInherited(), 'availableQuantity' => $data->getAvailableQuantityInherited(), 'taxRate' => $data->getTaxRateInherited(), ); } return new Response(json_encode($data)); } }