diff --git a/app/Resources/views/product/index.html.twig b/app/Resources/views/product/index.html.twig index 55566316..ea728dea 100755 --- a/app/Resources/views/product/index.html.twig +++ b/app/Resources/views/product/index.html.twig @@ -7,6 +7,7 @@ Id + Category Name Image Price @@ -22,6 +23,7 @@ {{ product.id }} + {{ product.category.name }} {{ product.name }} {{ product.image }} {{ product.price }} diff --git a/app/Resources/views/productcategory/index.html.twig b/app/Resources/views/productcategory/index.html.twig index ba9a9dd8..aa604c17 100755 --- a/app/Resources/views/productcategory/index.html.twig +++ b/app/Resources/views/productcategory/index.html.twig @@ -8,6 +8,7 @@ Id Nom + Produits Actions @@ -19,6 +20,7 @@ href="{{ path('productcategory_show', { 'id': productCategory.id }) }}">{{ productCategory.id }} {{ productCategory.name }} + {{ productCategory.products|length }} diff --git a/src/AppBundle/Controller/ProductCategoryController.php b/src/AppBundle/Controller/ProductCategoryController.php index 24582924..fe31afcc 100755 --- a/src/AppBundle/Controller/ProductCategoryController.php +++ b/src/AppBundle/Controller/ProductCategoryController.php @@ -23,7 +23,8 @@ class ProductCategoryController extends Controller { public function indexAction() { $em = $this->getDoctrine()->getManager(); - $productCategories = $em->getRepository( 'AppBundle:ProductCategory' )->findByUser($this->getUser() ); + $currentUser = $this->getUser(); + $productCategories = $currentUser->getCategories(); return $this->render( 'productcategory/index.html.twig', [