diff --git a/app/Resources/views/part/detail.html.twig b/app/Resources/views/part/detail.html.twig
index f098faf..9fbd654 100644
--- a/app/Resources/views/part/detail.html.twig
+++ b/app/Resources/views/part/detail.html.twig
@@ -5,8 +5,16 @@
{{ dump(part) }}
{{ dump(rbPart) }}
+ {{ dump(apiPart) }}
+
+ {% if apiPart is not null %}
+
+

+
+ {% endif %}
+
{% if part is not null %}
diff --git a/src/AppBundle/Api/Client/Rebrickable/Converter/PropertyNameConverter.php b/src/AppBundle/Api/Client/Rebrickable/Converter/PropertyNameConverter.php
index b5c47f8..53eaec5 100644
--- a/src/AppBundle/Api/Client/Rebrickable/Converter/PropertyNameConverter.php
+++ b/src/AppBundle/Api/Client/Rebrickable/Converter/PropertyNameConverter.php
@@ -14,7 +14,7 @@ class PropertyNameConverter implements NameConverterInterface
public function denormalize($propertyName)
{
switch ($propertyName) {
- case 'part_num': return 'number';
+ case 'part_num': return 'id';
case 'part_cat_id': return 'categoryId';
case 'part_img_url': return 'imgUrl';
case 'part_url': return 'url';
diff --git a/src/AppBundle/Api/Client/Rebrickable/Entity/Part.php b/src/AppBundle/Api/Client/Rebrickable/Entity/Part.php
index b845c54..cea1f01 100644
--- a/src/AppBundle/Api/Client/Rebrickable/Entity/Part.php
+++ b/src/AppBundle/Api/Client/Rebrickable/Entity/Part.php
@@ -2,27 +2,8 @@
namespace AppBundle\Api\Client\Rebrickable\Entity;
-class Part
+class Part extends \AppBundle\Entity\Rebrickable\Part
{
- /**
- * Part ID number.
- *
- * @var int
- */
- private $number;
- /**
- * Part Name.
- *
- * @var string
- */
- private $name;
- /**
- * Part category id.
- *
- * @var int
- */
- private $categoryId;
-
/**
* Year the part first appeared in sets.
*
@@ -41,6 +22,24 @@ class Part
* @var array
*/
private $externalIds;
+ /**
+ * Array of molds of part.
+ *
+ * @var array
+ */
+ private $molds;
+ /**
+ * Array of prints the part appears in.
+ *
+ * @var array
+ */
+ private $prints;
+ /**
+ * Array of alternative prts.
+ *
+ * @var array
+ */
+ private $alternates;
/**
* Rebrickable URL to the Part Details page.
*
@@ -54,70 +53,6 @@ class Part
*/
private $imgUrl;
- /**
- * @return int
- */
- public function getNumber()
- {
- return $this->number;
- }
-
- /**
- * @param int $number
- */
- public function setNumber($number)
- {
- $this->number = $number;
- }
-
- /**
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * @param string $name
- */
- public function setName($name)
- {
- $this->name = $name;
- }
-
- /**
- * @return int
- */
- public function getCategoryId()
- {
- return $this->categoryId;
- }
-
- /**
- * @param int $categoryId
- */
- public function setCategoryId($categoryId)
- {
- $this->categoryId = $categoryId;
- }
-
- /**
- * @return int
- */
- public function getType()
- {
- return $this->type;
- }
-
- /**
- * @param int $type
- */
- public function setType($type)
- {
- $this->type = $type;
- }
-
/**
* @return int
*/
@@ -166,6 +101,54 @@ class Part
$this->externalIds = $externalIds;
}
+ /**
+ * @return array
+ */
+ public function getAlternates()
+ {
+ return $this->alternates;
+ }
+
+ /**
+ * @param array $alternates
+ */
+ public function setAlternates($alternates)
+ {
+ $this->alternates = $alternates;
+ }
+
+ /**
+ * @return array
+ */
+ public function getMolds()
+ {
+ return $this->molds;
+ }
+
+ /**
+ * @param array $molds
+ */
+ public function setMolds($molds)
+ {
+ $this->molds = $molds;
+ }
+
+ /**
+ * @return array
+ */
+ public function getPrints()
+ {
+ return $this->prints;
+ }
+
+ /**
+ * @param array $prints
+ */
+ public function setPrints($prints)
+ {
+ $this->prints = $prints;
+ }
+
/**
* @return string
*/
diff --git a/src/AppBundle/Api/Manager/RebrickableManager.php b/src/AppBundle/Api/Manager/RebrickableManager.php
index d8997e8..a7bcfdc 100644
--- a/src/AppBundle/Api/Manager/RebrickableManager.php
+++ b/src/AppBundle/Api/Manager/RebrickableManager.php
@@ -142,26 +142,25 @@ class RebrickableManager
return $this->serializer->denormalize($data, Set::class.'[]', self::FORMAT);
}
- /**
- * Get a list of all parts (normal + spare) used in a set.
- *
- * @param $setId
- * @param $page
- *
- * @return
- */
- public function getSetParts($setId, $page = null)
- {
- $options = [
- 'query' => [
- 'page' => $page,
- ],
- ];
-//
-// $response = $this->rebrickableClient->call('GET','lego/sets/'.$setId.'/parts', $options);
+// /**
+// * Get a list of all parts (normal + spare) used in a set.
+// *
+// * @param $setId
+// * @param $page
+// *
+// * @return
+// */
+// public function getSetParts($setId, $page = null)
+// {
+// $options = [
+// 'query' => [
+// 'page' => $page,
+// ],
+// ];
//
+// $response = $this->rebrickableClient->call('GET', 'lego/sets/'.$setId.'/parts', $options);
// $data = json_decode($response, true)['results'];
//
-// return $this->serializer->denormalize($data, Part::class . '[]', self::FORMAT);
- }
+// return $this->serializer->denormalize($data, Part::class.'[]', self::FORMAT);
+// }
}
diff --git a/src/AppBundle/Controller/PartController.php b/src/AppBundle/Controller/PartController.php
index 8c484b0..afe6b10 100644
--- a/src/AppBundle/Controller/PartController.php
+++ b/src/AppBundle/Controller/PartController.php
@@ -26,6 +26,13 @@ class PartController extends Controller
$part = $em->getRepository(Part::class)->find($id);
$rbPart = $em->getRepository(\AppBundle\Entity\Rebrickable\Part::class)->find($id);
+ $apiPart = null;
+ try {
+ $apiPart = $this->get('manager.rebrickable')->getPart($id);
+ } catch (\Exception $e) {
+ dump($e);
+ }
+
$qb = $em->getRepository('AppBundle:Rebrickable\Inventory')->createQueryBuilder('i');
$qb->innerJoin(Inventory_Part::class, 'ip', Join::WITH, 'i.id = ip.inventory')
@@ -37,6 +44,7 @@ class PartController extends Controller
return $this->render('part/detail.html.twig', [
'part' => $part,
'rbPart' => $rbPart,
+ 'apiPart' => $apiPart,
'inventories' => $inventries,
]);
}