diff --git a/app/Resources/views/rebrickable/set/inventory_sets.html.twig b/app/Resources/views/rebrickable/set/inventory_sets.html.twig
deleted file mode 100644
index 098c2fc..0000000
--- a/app/Resources/views/rebrickable/set/inventory_sets.html.twig
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- {% for inventorySet in inventorySets %}
-
- {% endfor %}
-
\ No newline at end of file
diff --git a/src/AppBundle/Controller/Brickset/SetController.php b/src/AppBundle/Controller/Brickset/SetController.php
index 96658d3..25336ee 100644
--- a/src/AppBundle/Controller/Brickset/SetController.php
+++ b/src/AppBundle/Controller/Brickset/SetController.php
@@ -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;
@@ -37,7 +34,7 @@ class SetController extends Controller
'subtheme' => $data['subtheme'] ? $data['subtheme']->getSubtheme() : '',
'year' => $data['years'] ? $data['years']->getYear() : '',
]);
- } catch (EmptyResponseException $e) {
+ } catch (EmptyResponseException $e) {
$this->addFlash('warning', 'No set found on '.$e->getService());
} catch (\Exception $e) {
$this->addFlash('error', $e->getMessage());
@@ -58,13 +55,13 @@ class SetController extends Controller
$instructions = [];
try {
$instructions = $this->get('api.manager.brickset')->getSetInstructions($id);
- } catch (EmptyResponseException $e) {
-// $this->addFlash('warning', 'No instruction found on Brickset.com');
+ } catch (EmptyResponseException $e) {
+ // $this->addFlash('warning', 'No instruction found on Brickset.com');
} catch (\Exception $e) {
$this->addFlash('error', $e->getMessage());
}
- return $this->render('brickset/instructions.html.twig',[
+ return $this->render('brickset/instructions.html.twig', [
'instructions' => $instructions,
]);
}
@@ -77,13 +74,13 @@ class SetController extends Controller
$reviews = [];
try {
$reviews = $this->get('api.manager.brickset')->getSetReviews($id);
- } catch (EmptyResponseException $e) {
-// $this->addFlash('warning', 'No review found on Brickset.com');
+ } catch (EmptyResponseException $e) {
+ // $this->addFlash('warning', 'No review found on Brickset.com');
} catch (\Exception $e) {
$this->addFlash('error', $e->getMessage());
}
- return $this->render('brickset/reviews.html.twig',[
+ return $this->render('brickset/reviews.html.twig', [
'reviews' => $reviews,
]);
}
@@ -96,13 +93,13 @@ class SetController extends Controller
$images = [];
try {
$images = $this->get('api.manager.brickset')->getAdditionalImages($id);
- } catch (EmptyResponseException $e) {
-// $this->addFlash('warning', 'No images found on Brickset.com');
+ } catch (EmptyResponseException $e) {
+ // $this->addFlash('warning', 'No images found on Brickset.com');
} catch (\Exception $e) {
$this->addFlash('error', $e->getMessage());
}
- return $this->render('brickset/images.html.twig',[
+ return $this->render('brickset/images.html.twig', [
'images' => $images,
]);
}
diff --git a/src/AppBundle/Controller/Rebrickable/InventoryController.php b/src/AppBundle/Controller/Rebrickable/InventoryController.php
deleted file mode 100644
index 56480e9..0000000
--- a/src/AppBundle/Controller/Rebrickable/InventoryController.php
+++ /dev/null
@@ -1,37 +0,0 @@
-getDoctrine()->getManager();
-
- $inventorySets = $em->getRepository(Set::class)->findAllByInventory($inventory);
-
- return $this->render('rebrickable/set/inventory_sets.html.twig', [
- 'inventorySets' => $inventorySets,
- ]);
- }
-}
diff --git a/src/AppBundle/Controller/Rebrickable/PartController.php b/src/AppBundle/Controller/Rebrickable/PartController.php
index 1ca0637..421251c 100644
--- a/src/AppBundle/Controller/Rebrickable/PartController.php
+++ b/src/AppBundle/Controller/Rebrickable/PartController.php
@@ -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.
*
@@ -28,7 +52,7 @@ class PartController extends Controller
$apiPart = null;
- if($part) {
+ if ($part) {
try {
$apiPart = $this->get('api.manager.rebrickable')->getPart($part->getNumber());
} catch (EmptyResponseException $e) {