1
0
mirror of https://github.com/ToxicCrack/PrintABrick.git synced 2025-05-17 04:40:08 -07:00

Remove inventory controller

This commit is contained in:
David Hübner 2017-04-16 22:19:11 +02:00
parent 809b86ce19
commit e5451ff9cd
4 changed files with 35 additions and 68 deletions

View File

@ -1,17 +0,0 @@
<h4 class="ui horizontal divider header">
Sets
</h4>
<div class="ui eight column grid">
{% for inventorySet in inventorySets %}
<div class="column">
<div class="ui fluid bordered image">
<a href="{{ path('rebrickable_set_detail', {number: inventorySet.set}) }}">
<div class="image load">
<img src="{{ inventorySet.set|setImage| imagine_filter('rebrickable_set_min') }}" data-src="{{ inventorySet.set|setImage| imagine_filter('rebrickable_set_min') }}" class="transition visible">
</div>
<div class="ui bottom attached label">{{ inventorySet.set.number }}<br>{{ inventorySet.quantity }}</div>
</a>
</div>
</div>
{% endfor %}
</div>

View File

@ -3,9 +3,6 @@
namespace AppBundle\Controller\Brickset;
use AppBundle\Api\Exception\EmptyResponseException;
use AppBundle\Entity\Rebrickable\Color;
use AppBundle\Entity\Rebrickable\Inventory_Part;
use AppBundle\Entity\Rebrickable\Part;
use AppBundle\Entity\Rebrickable\Set;
use AppBundle\Entity\Rebrickable\Theme;
use AppBundle\Form\FilterSetType;

View File

@ -1,37 +0,0 @@
<?php
namespace AppBundle\Controller\Rebrickable;
use AppBundle\Api\Exception\EmptyResponseException;
use AppBundle\Entity\LDraw\Model;
use AppBundle\Entity\Rebrickable\Color;
use AppBundle\Entity\Rebrickable\Inventory;
use AppBundle\Entity\Rebrickable\Inventory_Part;
use AppBundle\Entity\Rebrickable\Inventory_Set;
use AppBundle\Entity\Rebrickable\Part;
use AppBundle\Entity\Rebrickable\Set;
use AppBundle\Entity\Rebrickable\Theme;
use AppBundle\Form\FilterSetType;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* @Route("/rebrickable/inventory")
*/
class InventoryController extends Controller
{
/**
* @Route("/{number}/inventory_sets", name="rebrickable_inventory_sets")
*/
public function inventoryAction(Inventory $inventory) {
$em = $this->getDoctrine()->getManager();
$inventorySets = $em->getRepository(Set::class)->findAllByInventory($inventory);
return $this->render('rebrickable/set/inventory_sets.html.twig', [
'inventorySets' => $inventorySets,
]);
}
}

View File

@ -3,11 +3,13 @@
namespace AppBundle\Controller\Rebrickable;
use AppBundle\Api\Exception\EmptyResponseException;
use AppBundle\Entity\Rebrickable\Category;
use AppBundle\Entity\Rebrickable\Part;
use AppBundle\Entity\Rebrickable\Set;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
/**
* Part controller.
@ -16,6 +18,28 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
*/
class PartController extends Controller
{
/**
* @Route("/", name="part_index")
*/
public function indexAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$queryBuilder = $em->getRepository(Part::class)->createQueryBuilder('part');
$queryBuilder->where('part.category = 17');
$paginator = $this->get('knp_paginator');
$sets = $paginator->paginate(
$queryBuilder->getQuery(),
$request->query->getInt('page', 1)/*page number*/,
$request->query->getInt('limit', 30)/*limit per page*/
);
return $this->render(':rebrickable/part:index.html.twig', [
'parts' => $sets,
]);
}
/**
* Finds and displays a part entity.
*