created partials
This commit is contained in:
parent
b16307c2d2
commit
54e64597e3
9 changed files with 296 additions and 31 deletions
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Enum;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ class PrinterService
|
|||
public function createPrinter(string $jsonString): Printer
|
||||
{
|
||||
$printer = $this->serializer->deserialize($jsonString, Printer::class, 'json');
|
||||
|
||||
$this->entityManager->persist($printer);
|
||||
$this->entityManager->flush();
|
||||
|
||||
|
@ -40,9 +41,9 @@ class PrinterService
|
|||
$jsonArray = json_decode($json, true);
|
||||
|
||||
$printer->setName($jsonArray['name'] ?? $printer->getName());
|
||||
$printer->setPrice($jsonArray['price'] ?? $printer->getPrice());
|
||||
$printer->setPrice((float)($jsonArray['price'] ?? $printer->getPrice()));
|
||||
$printer->setBuildVolume($jsonArray['build_volume'] ?? $printer->getBuildVolume());
|
||||
$printer->setMaxSpeed($jsonArray['max_speed'] ?? $printer->getMaxSpeed());
|
||||
$printer->setMaxSpeed((float)($jsonArray['max_speed'] ?? $printer->getMaxSpeed()));
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue