1
0
mirror of https://github.com/ToxicCrack/PrintABrick.git synced 2025-05-17 12:50:08 -07:00
This commit is contained in:
Unknown 2017-06-08 20:29:09 +02:00
parent 69aaca9740
commit 5fb396d62f
19 changed files with 70 additions and 75 deletions

View File

@ -82,14 +82,7 @@
{% endfor %} {% endfor %}
</div> </div>
{#<div class="ui grid stackable">#}
{#<div class="right floated right aligned four wide column">#}
{#</div>#}
{#<div class="left floated left aligned twelve wide column">#}
<h1 class="ui header">{% block header %}{% endblock %}</h1> <h1 class="ui header">{% block header %}{% endblock %}</h1>
{#</div>#}
{#</div>#}
{% for label, flashes in app.session.flashbag.all %} {% for label, flashes in app.session.flashbag.all %}
{% for flash in flashes %} {% for flash in flashes %}

View File

@ -43,10 +43,12 @@
<div class="ui header segment vertical sort"> <div class="ui header segment vertical sort">
<div class="ui grid stackable"> <div class="ui grid stackable">
<div class="five wide column"> <div class="five wide column">
{% if models.paginationData['totalCount'] %}
<div class="ui text left floated menu"> <div class="ui text left floated menu">
<div class="header item">Showing</div> <div class="header item">Showing</div>
<span class="item">{{ models.paginationData['firstItemNumber']~' - '~models.paginationData['lastItemNumber'] }} of {{ models.getTotalItemCount }} items</span> <span class="item">{{ models.paginationData['firstItemNumber']~' - '~models.paginationData['lastItemNumber'] }} of {{ models.getTotalItemCount }} items</span>
</div> </div>
{% endif %}
</div> </div>
<div class="eleven wide column"> <div class="eleven wide column">
@ -56,6 +58,7 @@
{{ knp_pagination_sortable(models, 'Name', 'm.name') }} {{ knp_pagination_sortable(models, 'Name', 'm.name') }}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="ui segment vertical"> <div class="ui segment vertical">

View File

@ -51,10 +51,12 @@
<div class="ui header segment vertical sort"> <div class="ui header segment vertical sort">
<div class="ui grid stackable"> <div class="ui grid stackable">
<div class="five wide column"> <div class="five wide column">
{% if sets.paginationData['totalCount'] %}
<div class="ui text left floated menu"> <div class="ui text left floated menu">
<div class="header item">Showing</div> <div class="header item">Showing</div>
<span class="item">{{ sets.paginationData['firstItemNumber']~' - '~sets.paginationData['lastItemNumber'] }} of {{ sets.getTotalItemCount }} items</span> <span class="item">{{ sets.paginationData['firstItemNumber']~' - '~sets.paginationData['lastItemNumber'] }} of {{ sets.getTotalItemCount }} items</span>
</div> </div>
{% endif %}
</div> </div>
<div class="eleven wide column"> <div class="eleven wide column">
@ -67,6 +69,7 @@
{{ knp_pagination_sortable(sets, 'Parts', ['s.partCount']) }} {{ knp_pagination_sortable(sets, 'Parts', ['s.partCount']) }}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="ui segment vertical"> <div class="ui segment vertical">

View File

@ -42,7 +42,7 @@ class BricksetClient
/** /**
* BricksetClient constructor. * BricksetClient constructor.
* *
* @param string $apikey Brickset API key * @param string $apiKey Brickset API key
* @param array $options A array of config values * @param array $options A array of config values
* *
* @throws ApiException * @throws ApiException

View File

@ -98,5 +98,7 @@ class LoadLdrawCommand extends ContainerAwareCommand
} }
$this->release(); $this->release();
return 0;
} }
} }

View File

@ -11,6 +11,9 @@ class AjaxController extends AbstractController
{ {
/** /**
* @Route("/set_tab/{tab}", name="set_tab", requirements={"tab"=".+"}) * @Route("/set_tab/{tab}", name="set_tab", requirements={"tab"=".+"})
* @param Request $request
* @param $tab
* @return Response
*/ */
public function setDefaultTabAction(Request $request, $tab) public function setDefaultTabAction(Request $request, $tab)
{ {

View File

@ -17,6 +17,8 @@ class ColorController extends AbstractController
{ {
/** /**
* @Route("/", name="color_index") * @Route("/", name="color_index")
* @param ColorService $colorService
* @return \Symfony\Component\HttpFoundation\Response
*/ */
public function indexAction(ColorService $colorService) public function indexAction(ColorService $colorService)
{ {

View File

@ -135,8 +135,7 @@ class Color
} }
/** /**
* @param Inventory_Part $part_building_kit * @param Inventory_Part $inventoryPart
*
* @return Color * @return Color
*/ */
public function addPartInventoryPart(Inventory_Part $inventoryPart) public function addPartInventoryPart(Inventory_Part $inventoryPart)
@ -147,7 +146,7 @@ class Color
} }
/** /**
* @param Inventory_Part $part_building_kit * @param Inventory_Part $inventoryPart
* *
* @return Color * @return Color
*/ */

View File

@ -166,6 +166,8 @@ class Model
/** /**
* @param string $name * @param string $name
*
* @return Model
*/ */
public function setName($name) public function setName($name)
{ {

View File

@ -48,20 +48,6 @@ class Inventory_Part
*/ */
protected $inventory; protected $inventory;
/**
* Set count.
*
* @param int $count
*
* @return Inventory_Part
*/
public function setCount($count)
{
$this->count = $count;
return $this;
}
/** /**
* Get count. * Get count.
* *

View File

@ -68,6 +68,7 @@ class SetSearchType extends AbstractType
'choice_label' => 'fullName', 'choice_label' => 'fullName',
'choice_translation_domain' => false, 'choice_translation_domain' => false,
'group_by' => function ($theme, $key, $index) { 'group_by' => function ($theme, $key, $index) {
/** @var Theme $theme */
$parent = $theme->getParent(); $parent = $theme->getParent();
return $parent ? $parent->getParent() ? $parent->getParent()->getName() : $parent->getName() : $theme->getName(); return $parent ? $parent->getParent() ? $parent->getParent()->getName() : $parent->getName() : $theme->getName();

View File

@ -11,7 +11,7 @@ class ColorRepository extends BaseRepository
{ {
public function findAllBySet(Set $set) public function findAllBySet(Set $set)
{ {
$inventory = $this->getEntityManager()->getRepository(Inventory::class)->findNewestInventoryBySetNumber($set->getNumber()); $inventory = $this->getEntityManager()->getRepository(Inventory::class)->findNewestInventoryBySetNumber($set->getId());
$queryBuilder = $this->createQueryBuilder('color'); $queryBuilder = $this->createQueryBuilder('color');

View File

@ -16,8 +16,10 @@ class SubpartRepository extends BaseRepository
/** /**
* Create new Subpart relation entity or retrieve one by foreign keys. * Create new Subpart relation entity or retrieve one by foreign keys.
* *
* @param $name * @param $parent
* * @param $child
* @param $count
* @param $colorId
* @return Subpart * @return Subpart
*/ */
public function getOrCreate($parent, $child, $count, $colorId) public function getOrCreate($parent, $child, $count, $colorId)
@ -29,6 +31,7 @@ class SubpartRepository extends BaseRepository
$colorRepository = $this->getEntityManager()->getRepository(Color::class); $colorRepository = $this->getEntityManager()->getRepository(Color::class);
if (!($color = $colorRepository->find($colorId))) { if (!($color = $colorRepository->find($colorId))) {
/** @var Color $color */
$color = $colorRepository->find(-1); $color = $colorRepository->find(-1);
} }

View File

@ -36,7 +36,7 @@ class SetRepository extends Repository
$boolQuery->addMust($query); $boolQuery->addMust($query);
} else { } else {
$query = new \Elastica\Query\MatchAll(); $query = new Query\MatchAll();
$boolQuery->addMust($query); $boolQuery->addMust($query);
} }

View File

@ -13,6 +13,7 @@ class ColorService
/** /**
* ColorService constructor. * ColorService constructor.
* @param EntityManagerInterface $em
*/ */
public function __construct(EntityManagerInterface $em) public function __construct(EntityManagerInterface $em)
{ {

View File

@ -12,7 +12,6 @@ use Psr\Log\LoggerInterface;
use Symfony\Component\Asset\Exception\LogicException; use Symfony\Component\Asset\Exception\LogicException;
use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Debug\Exception\ContextErrorException;
abstract class BaseLoader abstract class BaseLoader
{ {
@ -65,6 +64,7 @@ abstract class BaseLoader
* Initialize new progress bar. * Initialize new progress bar.
* *
* @param $total * @param $total
* @param string $format
*/ */
protected function initProgressBar($total, $format = 'loader') protected function initProgressBar($total, $format = 'loader')
{ {

View File

@ -60,6 +60,7 @@ class ImageLoader extends BaseLoader
// Get models without image // Get models without image
$missing = []; $missing = [];
$models = $this->em->getRepository(Model::class)->findAll(); $models = $this->em->getRepository(Model::class)->findAll();
/** @var Model $model */
foreach ($models as $model) { foreach ($models as $model) {
if (!$this->mediaFilesystem->has('images'.DIRECTORY_SEPARATOR.'-1'.DIRECTORY_SEPARATOR.$model->getId().'.png')) { if (!$this->mediaFilesystem->has('images'.DIRECTORY_SEPARATOR.'-1'.DIRECTORY_SEPARATOR.$model->getId().'.png')) {
$missing[] = $model; $missing[] = $model;

View File

@ -134,7 +134,7 @@ class ModelLoader extends BaseLoader
try { try {
$connection->beginTransaction(); $connection->beginTransaction();
$this->getFileContext($file); $this->loadFileContext($file);
$this->loadModel($file); $this->loadModel($file);
$connection->commit(); $connection->commit();
@ -206,6 +206,7 @@ class ModelLoader extends BaseLoader
// Return model from database if rewrite is not enabled // Return model from database if rewrite is not enabled
if (!$this->rewrite && $model = $modelRepository->find(basename($file, '.dat'))) { if (!$this->rewrite && $model = $modelRepository->find(basename($file, '.dat'))) {
/** @var Model $model */
return $model; return $model;
} }
@ -329,7 +330,6 @@ class ModelLoader extends BaseLoader
* *
* *
* @param $id * @param $id
* @param Filesystem $context
* *
* @return string * @return string
*/ */
@ -359,18 +359,14 @@ class ModelLoader extends BaseLoader
* Get new filesystem context of current file. * Get new filesystem context of current file.
* *
* @param $file * @param $file
*
* @return Filesystem
*/ */
private function getFileContext($file) private function loadFileContext($file)
{ {
try { try {
$adapter = new Local(dirname($file)); $adapter = new Local(dirname($file));
$this->fileContext = new Filesystem($adapter); $this->fileContext = new Filesystem($adapter);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->logger->error($exception->getMessage()); $this->logger->error($exception->getMessage());
return null;
} }
} }

View File

@ -27,9 +27,9 @@ class LDModelParser
* *
* LDraw.org Standards: Official Library Header Specification (http://www.ldraw.org/article/398.html) * LDraw.org Standards: Official Library Header Specification (http://www.ldraw.org/article/398.html)
* *
* @throws ErrorParsingLineException * @param $string
*
* @return array * @return array
* @throws ErrorParsingLineException
*/ */
public function parse($string) public function parse($string)
{ {