fields in listing

This commit is contained in:
Kayn Ty 2018-04-20 09:44:15 +02:00
parent a3b1753d9a
commit 4e1cf2e348
3 changed files with 7 additions and 1 deletions

View File

@ -7,6 +7,7 @@
<thead class="bg-dark"> <thead class="bg-dark">
<tr> <tr>
<th>Id</th> <th>Id</th>
<th>Category</th>
<th>Name</th> <th>Name</th>
<th>Image</th> <th>Image</th>
<th>Price</th> <th>Price</th>
@ -22,6 +23,7 @@
<a class="btn btn-primary" <a class="btn btn-primary"
href="{{ path('product_show', { 'id': product.id }) }}">{{ product.id }}</a> href="{{ path('product_show', { 'id': product.id }) }}">{{ product.id }}</a>
</td> </td>
<td>{{ product.category.name }}</td>
<td>{{ product.name }}</td> <td>{{ product.name }}</td>
<td>{{ product.image }}</td> <td>{{ product.image }}</td>
<td>{{ product.price }}</td> <td>{{ product.price }}</td>

View File

@ -8,6 +8,7 @@
<tr> <tr>
<th>Id</th> <th>Id</th>
<th>Nom</th> <th>Nom</th>
<th>Produits</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
</thead> </thead>
@ -19,6 +20,7 @@
href="{{ path('productcategory_show', { 'id': productCategory.id }) }}">{{ productCategory.id }}</a> href="{{ path('productcategory_show', { 'id': productCategory.id }) }}">{{ productCategory.id }}</a>
</td> </td>
<td>{{ productCategory.name }}</td> <td>{{ productCategory.name }}</td>
<td>{{ productCategory.products|length }}</td>
<td> <td>
<ul> <ul>
<li> <li>
@ -30,6 +32,7 @@
<a class="btn btn-primary" <a class="btn btn-primary"
href="{{ path('productcategory_edit', { 'id': productCategory.id }) }}"> href="{{ path('productcategory_edit', { 'id': productCategory.id }) }}">
<i class="fa fa-pencil"></i> <i class="fa fa-pencil"></i>
edit
</a> </a>
</li> </li>
</ul> </ul>

View File

@ -23,7 +23,8 @@ class ProductCategoryController extends Controller {
public function indexAction() { public function indexAction() {
$em = $this->getDoctrine()->getManager(); $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', return $this->render( 'productcategory/index.html.twig',
[ [