mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-29 10:10:25 -07:00
Show model data in template
This commit is contained in:
parent
39f69d2110
commit
27210e650c
File diff suppressed because one or more lines are too long
@ -4,4 +4,8 @@
|
|||||||
|
|
||||||
{{ dump(part) }}
|
{{ dump(part) }}
|
||||||
|
|
||||||
|
{{ dump(localPart) }}
|
||||||
|
|
||||||
|
{{ dump(model) }}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -3,7 +3,7 @@
|
|||||||
# To use this hook you need to install php-cs-fixer
|
# To use this hook you need to install php-cs-fixer
|
||||||
# Copy this file to ./git/hooks/pre-commit to get it working.
|
# Copy this file to ./git/hooks/pre-commit to get it working.
|
||||||
|
|
||||||
ROOT="/"
|
ROOT=""
|
||||||
|
|
||||||
echo "php-cs-fixer pre commit hook start"
|
echo "php-cs-fixer pre commit hook start"
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ fi
|
|||||||
|
|
||||||
if $HAS_PHP_CS_FIXER; then
|
if $HAS_PHP_CS_FIXER; then
|
||||||
git status --porcelain | grep -e '^[AM]\(.*\).php$' | cut -c 3- | while read line; do
|
git status --porcelain | grep -e '^[AM]\(.*\).php$' | cut -c 3- | while read line; do
|
||||||
$PHP_CS_FIXER fix --config-file=$ROOT/.php_cs --verbose "$line";
|
$PHP_CS_FIXER fix --config=$ROOT/.php_cs --verbose "$line";
|
||||||
git add "$line";
|
git add "$line";
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
30
src/AppBundle/Controller/PartController.php
Normal file
30
src/AppBundle/Controller/PartController.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace AppBundle\Controller;
|
||||||
|
|
||||||
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("rebrickable/part")
|
||||||
|
*/
|
||||||
|
class PartController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @Route("/{id}", name="part_detail")
|
||||||
|
*/
|
||||||
|
public function detailAction($id)
|
||||||
|
{
|
||||||
|
$part = $this->get('manager.rebrickable')->getPart($id);
|
||||||
|
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
$localPart = $em->getRepository('AppBundle:Part')->findBy(['id' => $id]);
|
||||||
|
$model = $em->getRepository('AppBundle:Model')->findBy(['number' => $id]);
|
||||||
|
|
||||||
|
return $this->render('part/detail.html.twig', [
|
||||||
|
'part' => $part,
|
||||||
|
'localPart' => $localPart,
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
@ -1,24 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace AppBundle\Controller;
|
|
||||||
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route("rebrickable/parts")
|
|
||||||
*/
|
|
||||||
class PartsController extends Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @Route("/{id}", name="part_detail")
|
|
||||||
*/
|
|
||||||
public function detailAction($id)
|
|
||||||
{
|
|
||||||
$part = $this->get('manager.rebrickable')->getPartById($id);
|
|
||||||
|
|
||||||
return $this->render('parts/detail.html.twig', [
|
|
||||||
'part' => $part,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,12 +8,12 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/brickset/sets")
|
* @Route("/brickset/set")
|
||||||
*/
|
*/
|
||||||
class SetsController extends Controller
|
class SetController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @Route("/", name="sets_browse")
|
* @Route("/", name="set_browse")
|
||||||
*/
|
*/
|
||||||
public function browseAction(Request $request)
|
public function browseAction(Request $request)
|
||||||
{
|
{
|
||||||
@ -32,7 +32,7 @@ class SetsController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('sets/browse.html.twig', [
|
return $this->render('set/browse.html.twig', [
|
||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
'sets' => $sets,
|
'sets' => $sets,
|
||||||
]);
|
]);
|
||||||
@ -45,11 +45,8 @@ class SetsController extends Controller
|
|||||||
{
|
{
|
||||||
$set = $this->get('manager.brickset')->getSetById($id);
|
$set = $this->get('manager.brickset')->getSetById($id);
|
||||||
|
|
||||||
$parts = $this->get('sevice.collection')->getSet($set->getNumber().'-'.$set->getNumberVariant())->getParts();
|
return $this->render('set/detail.html.twig', [
|
||||||
|
|
||||||
return $this->render('sets/detail.html.twig', [
|
|
||||||
'set' => $set,
|
'set' => $set,
|
||||||
'parts' => $parts,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ class Builder
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$menu->addChild('Sets', [
|
$menu->addChild('Sets', [
|
||||||
'route' => 'sets_browse',
|
'route' => 'set_browse',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $menu;
|
return $menu;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user