@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | |
| 73 | 73 | //The form is initially empty, we have to define the fields after we know the data |
| 74 | - $builder->addEventListener(FormEvents::PRE_SET_DATA, function (PreSetDataEvent $event) { |
|
| 74 | + $builder->addEventListener(FormEvents::PRE_SET_DATA, function(PreSetDataEvent $event) { |
|
| 75 | 75 | $form = $event->getForm(); |
| 76 | 76 | /** @var ProjectBuildRequest $build_request */ |
| 77 | 77 | $build_request = $event->getData(); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | foreach ($build_request->getPartBomEntries() as $bomEntry) { |
| 95 | 95 | //Every part lot has a field to specify the number of parts to take from this lot |
| 96 | 96 | foreach ($build_request->getPartLotsForBOMEntry($bomEntry) as $lot) { |
| 97 | - $form->add('lot_' . $lot->getID(), SIUnitType::class, [ |
|
| 97 | + $form->add('lot_'.$lot->getID(), SIUnitType::class, [ |
|
| 98 | 98 | 'label' => false, |
| 99 | 99 | 'measurement_unit' => $bomEntry->getPart()->getPartUnit(), |
| 100 | 100 | 'max' => min($build_request->getNeededAmountForBOMEntry($bomEntry), $lot->getAmount()), |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | public function mapDataToForms($data, \Traversable $forms) |
| 110 | 110 | { |
| 111 | 111 | if (!$data instanceof ProjectBuildRequest) { |
| 112 | - throw new \RuntimeException('Data must be an instance of ' . ProjectBuildRequest::class); |
|
| 112 | + throw new \RuntimeException('Data must be an instance of '.ProjectBuildRequest::class); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** @var FormInterface[] $forms */ |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | public function mapFormsToData(\Traversable $forms, &$data) |
| 135 | 135 | { |
| 136 | 136 | if (!$data instanceof ProjectBuildRequest) { |
| 137 | - throw new \RuntimeException('Data must be an instance of ' . ProjectBuildRequest::class); |
|
| 137 | + throw new \RuntimeException('Data must be an instance of '.ProjectBuildRequest::class); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** @var FormInterface[] $forms */ |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | $lot = $forms['buildsPartLot']->getData(); |
| 155 | 155 | if (!$lot) { //When the user selected "Create new lot", create a new lot |
| 156 | 156 | $lot = new PartLot(); |
| 157 | - $description = 'Build ' . date('Y-m-d H:i:s'); |
|
| 157 | + $description = 'Build '.date('Y-m-d H:i:s'); |
|
| 158 | 158 | if (!empty($data->getComment())) { |
| 159 | - $description .= ' (' . $data->getComment() . ')'; |
|
| 159 | + $description .= ' ('.$data->getComment().')'; |
|
| 160 | 160 | } |
| 161 | 161 | $lot->setDescription($description); |
| 162 | 162 | |
@@ -43,16 +43,16 @@ |
||
| 43 | 43 | |
| 44 | 44 | $resolver->setDefaults([ |
| 45 | 45 | 'class' => PartLot::class, |
| 46 | - 'choice_label' => ChoiceList::label($this, function (PartLot $part_lot) { |
|
| 46 | + 'choice_label' => ChoiceList::label($this, function(PartLot $part_lot) { |
|
| 47 | 47 | return ($part_lot->getStorageLocation() ? $part_lot->getStorageLocation()->getFullPath() : '') |
| 48 | - . ' (' . $part_lot->getName() . '): ' . $part_lot->getAmount(); |
|
| 48 | + . ' ('.$part_lot->getName().'): '.$part_lot->getAmount(); |
|
| 49 | 49 | }), |
| 50 | 50 | 'attr' => [ |
| 51 | 51 | 'data-controller' => 'elements--selectpicker', |
| 52 | 52 | 'data-live-search' => true, |
| 53 | 53 | ], |
| 54 | - 'query_builder' => function (Options $options) { |
|
| 55 | - return function (EntityRepository $er) use ($options) { |
|
| 54 | + 'query_builder' => function(Options $options) { |
|
| 55 | + return function(EntityRepository $er) use ($options) { |
|
| 56 | 56 | return $er->createQueryBuilder('l') |
| 57 | 57 | ->where('l.part = :part') |
| 58 | 58 | ->setParameter('part', $options['part']); |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | $this->initializeArray(); |
| 57 | 57 | |
| 58 | 58 | //By default, use the first available lot of builds part if there is one. |
| 59 | - if($project->getBuildPart() !== null) { |
|
| 59 | + if ($project->getBuildPart() !== null) { |
|
| 60 | 60 | $this->add_build_to_builds_part = true; |
| 61 | - foreach( $project->getBuildPart()->getPartLots() as $lot) { |
|
| 61 | + foreach ($project->getBuildPart()->getPartLots() as $lot) { |
|
| 62 | 62 | if (!$lot->isInstockUnknown()) { |
| 63 | 63 | $this->builds_lot = $lot; |
| 64 | 64 | break; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | //Now create an array for each BOM entry |
| 76 | 76 | foreach ($this->getPartBomEntries() as $bom_entry) { |
| 77 | 77 | $remaining_amount = $this->getNeededAmountForBOMEntry($bom_entry); |
| 78 | - foreach($this->getPartLotsForBOMEntry($bom_entry) as $lot) { |
|
| 78 | + foreach ($this->getPartLotsForBOMEntry($bom_entry) as $lot) { |
|
| 79 | 79 | //If the lot has instock use it for the build |
| 80 | 80 | $this->withdraw_amounts[$lot->getID()] = min($remaining_amount, $lot->getAmount()); |
| 81 | 81 | $remaining_amount -= max(0, $this->withdraw_amounts[$lot->getID()]); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | throw new \InvalidArgumentException('The given lot must be an instance of PartLot or an ID of a PartLot!'); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if (! array_key_exists($lot_id, $this->withdraw_amounts)) { |
|
| 187 | + if (!array_key_exists($lot_id, $this->withdraw_amounts)) { |
|
| 188 | 188 | throw new \InvalidArgumentException('The given lot is not in the withdraw amounts array!'); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | public function getPartBomEntries(): array |
| 279 | 279 | { |
| 280 | - return $this->project->getBomEntries()->filter(function (ProjectBOMEntry $entry) { |
|
| 280 | + return $this->project->getBomEntries()->filter(function(ProjectBOMEntry $entry) { |
|
| 281 | 281 | return $entry->isPartBomEntry(); |
| 282 | 282 | })->toArray(); |
| 283 | 283 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | private function buildViolationForLot(PartLot $partLot, string $message): ConstraintViolationBuilderInterface |
| 33 | 33 | { |
| 34 | 34 | return $this->context->buildViolation($message) |
| 35 | - ->atPath('lot_' . $partLot->getID()) |
|
| 35 | + ->atPath('lot_'.$partLot->getID()) |
|
| 36 | 36 | ->setParameter('{{ lot }}', $partLot->getName()); |
| 37 | 37 | } |
| 38 | 38 | |