import hiltes

This commit is contained in:
mmoeller
2023-02-06 10:11:39 +01:00
parent 991dd95e9d
commit 0c04e6da7c
24 changed files with 100882 additions and 563 deletions

View File

@@ -1,65 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\HlsCountryRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: HlsCountryRepository::class)]
class HlsCountry
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $short_name = null;
#[ORM\Column(length: 255)]
private ?string $short_iso = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
public function getId(): ?int
{
return $this->id;
}
public function getShortName(): ?string
{
return $this->short_name;
}
public function setShortName(string $short_name): self
{
$this->short_name = $short_name;
return $this;
}
public function getShortIso(): ?string
{
return $this->short_iso;
}
public function setShortIso(string $short_iso): self
{
$this->short_iso = $short_iso;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
}

68
src/Entity/Order.php Normal file
View File

@@ -0,0 +1,68 @@
<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\OrderRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: OrderRepository::class)]
#[ORM\Table(name: '`order`')]
#[ApiResource]
class Order
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $orderId = null;
#[ORM\Column]
private ?int $status = null;
#[ORM\Column]
private array $data = [];
public function getId(): ?int
{
return $this->id;
}
public function getOrderId(): ?string
{
return $this->orderId;
}
public function setOrderId(string $orderId): self
{
$this->orderId = $orderId;
return $this;
}
public function getStatus(): ?int
{
return $this->status;
}
public function setStatus(int $status): self
{
$this->status = $status;
return $this;
}
public function getData(): array
{
return $this->data;
}
public function setData(array $data): self
{
$this->data = $data;
return $this;
}
}

View File

@@ -1,78 +0,0 @@
<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiProperty;
use App\Repository\OrdersRepository;
use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Core\Annotation\ApiResource;
#[ORM\Entity(repositoryClass: OrdersRepository::class)]
#[ORM\HasLifecycleCallbacks]
#[ApiResource(
description: "Manage orders",
itemOperations: ["GET"],
normalizationContext: ["groups" => "read"]
)]
class Orders
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
/** Shopware Order ID */
#[ORM\Column(type: 'string', length: 255)]
#[Assert\NotBlank]
#[ApiProperty(example: "467e9804347c4071942c99b55b108142")]
#[Group("read")]
private $order_id;
#[ORM\Column(type: 'integer')]
#[ApiProperty(example: "1")]
private $status;
#[ORM\Column(type: 'json')]
#[ApiProperty(writable: false)]
private $data = [];
public function getId(): ?int
{
return $this->id;
}
public function getOrderId(): ?string
{
return $this->order_id;
}
public function setOrderId(string $order_id): self
{
$this->order_id = $order_id;
return $this;
}
public function getStatus(): ?int
{
return $this->status;
}
public function setStatus(int $status): self
{
$this->status = $status;
return $this;
}
public function getData(): ?array
{
return $this->data;
}
#[ORM\PrePersist]
public function setData(array $data): self
{
$this->data = $data;
return $this;
}
}

83
src/Entity/Product.php Normal file
View File

@@ -0,0 +1,83 @@
<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\ProductRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ProductRepository::class)]
#[ApiResource]
class Product
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $gtin = null;
#[ORM\Column(length: 255)]
private ?string $shopwareId = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $updateTime = null;
#[ORM\OneToOne(inversedBy: 'product', cascade: ['persist', 'remove'])]
private ?Stock $stock = null;
public function getId(): ?int
{
return $this->id;
}
public function getGtin(): ?string
{
return $this->gtin;
}
public function setGtin(string $gtin): self
{
$this->gtin = $gtin;
return $this;
}
public function getShopwareId(): ?string
{
return $this->shopwareId;
}
public function setShopwareId(string $shopwareId): self
{
$this->shopwareId = $shopwareId;
return $this;
}
public function getUpdateTime(): ?\DateTimeInterface
{
return $this->updateTime;
}
public function setUpdateTime(\DateTimeInterface $updateTime): self
{
$this->updateTime = $updateTime;
return $this;
}
public function getStock(): ?Stock
{
return $this->stock;
}
public function setStock(?Stock $stock): self
{
$this->stock = $stock;
return $this;
}
}

View File

@@ -1,76 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\ProductsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ProductsRepository::class)]
class Products
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::GUID, nullable: true)]
private ?string $shopware_id = null;
#[ORM\OneToMany(mappedBy: 'prod_id', targetEntity: Stock::class)]
private Collection $stocks;
public function __construct()
{
$this->stocks = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getShopwareId(): ?string
{
return $this->shopware_id;
}
public function setShopwareId(?string $shopware_id): self
{
$this->shopware_id = $shopware_id;
return $this;
}
/**
* @return Collection<int, Stock>
*/
public function getStocks(): Collection
{
return $this->stocks;
}
public function addStock(Stock $stock): self
{
if (!$this->stocks->contains($stock)) {
$this->stocks->add($stock);
$stock->setProdId($this);
}
return $this;
}
public function removeStock(Stock $stock): self
{
if ($this->stocks->removeElement($stock)) {
// set the owning side to null (unless already changed)
if ($stock->getProdId() === $this) {
$stock->setProdId(null);
}
}
return $this;
}
}

50
src/Entity/Settings.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
namespace App\Entity;
use App\Repository\SettingsRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: SettingsRepository::class)]
class Settings
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(length: 255)]
private ?string $value = null;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getValue(): ?string
{
return $this->value;
}
public function setValue(string $value): self
{
$this->value = $value;
return $this;
}
}

View File

@@ -10,92 +10,66 @@ class Stock
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: 'string', length: 255)]
private $gtin;
#[ORM\Column]
private ?int $instock = null;
#[ORM\Column(type: 'integer')]
private $stock;
#[ORM\Column(type: 'datetime', nullable: true)]
private $update_time;
#[ORM\ManyToOne(targetEntity: Warehouse::class, inversedBy: 'warehouse_id')]
private $warehouse_id;
#[ORM\OneToOne(mappedBy: 'stock', cascade: ['persist', 'remove'])]
private ?Product $product = null;
#[ORM\ManyToOne(inversedBy: 'stocks')]
private ?Products $prod_id = null;
private ?Warehouse $warehouse = null;
public function getId(): ?int
{
return $this->id;
}
public function getGtin(): ?string
public function getInstock(): ?int
{
return $this->gtin;
return $this->instock;
}
public function setGtin(string $gtin): self
public function setInstock(int $instock): self
{
$this->gtin = $gtin;
$this->instock = $instock;
return $this;
}
public function getStock(): ?int
public function getProduct(): ?Product
{
return $this->stock;
return $this->product;
}
public function setStock(int $stock): self
public function setProduct(?Product $product): self
{
$this->stock = $stock;
// unset the owning side of the relation if necessary
if ($product === null && $this->product !== null) {
$this->product->setStock(null);
}
// set the owning side of the relation if necessary
if ($product !== null && $product->getStock() !== $this) {
$product->setStock($this);
}
$this->product = $product;
return $this;
}
public function getUpdateTime(): ?\DateTimeInterface
public function getWarehouse(): ?Warehouse
{
return $this->update_time;
return $this->warehouse;
}
public function setUpdateTime(?\DateTimeInterface $update_time): self
public function setWarehouse(?Warehouse $warehouse): self
{
$this->update_time = $update_time;
$this->warehouse = $warehouse;
return $this;
}
public function getWarehouseId(): ?int
{
return $this->warehouse_id;
}
public function setWarehouseId(int $warehouse_id): self
{
$this->warehouse_id = $warehouse_id;
return $this;
}
public function getProdId(): ?Products
{
return $this->prod_id;
}
public function setProdId(?Products $prod_id): self
{
$this->prod_id = $prod_id;
return $this;
}
public function setWarehouse(Warehouse $warehouse): self
{
$this->warehouse_id = $warehouse->getId();
return $this;
}
}

View File

@@ -12,18 +12,21 @@ class Warehouse
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column]
private ?int $id = null;
#[ORM\OneToMany(mappedBy: 'warehouse_id', targetEntity: Stock::class)]
private $warehouse_id;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(type: 'integer')]
private $priority;
#[ORM\Column]
private ?int $prio = null;
#[ORM\OneToMany(mappedBy: 'warehouse', targetEntity: Stock::class)]
private Collection $stocks;
public function __construct()
{
$this->warehouse_id = new ArrayCollection();
$this->stocks = new ArrayCollection();
}
public function getId(): ?int
@@ -31,16 +34,26 @@ class Warehouse
return $this->id;
}
public function setID(int $id): self
public function getName(): ?string
{
$this->id = $id;
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function setWarehouseId(int $warehouse_id): self
public function getPrio(): ?int
{
$this->warehouse_id = $warehouse_id;
return $this->prio;
}
public function setPrio(int $prio): self
{
$this->prio = $prio;
return $this;
}
@@ -48,41 +61,30 @@ class Warehouse
/**
* @return Collection<int, Stock>
*/
public function getWarehouseId(): Collection
public function getStocks(): Collection
{
return $this->warehouse_id;
return $this->stocks;
}
public function addWarehouseId(Stock $warehouseId): self
public function addStock(Stock $stock): self
{
if (!$this->warehouse_id->contains($warehouseId)) {
$this->warehouse_id[] = $warehouseId;
$warehouseId->setWarehouseId($this);
if (!$this->stocks->contains($stock)) {
$this->stocks->add($stock);
$stock->setWarehouse($this);
}
return $this;
}
public function removeWarehouseId(Stock $warehouseId): self
public function removeStock(Stock $stock): self
{
if ($this->warehouse_id->removeElement($warehouseId)) {
if ($this->stocks->removeElement($stock)) {
// set the owning side to null (unless already changed)
if ($warehouseId->getWarehouseId() === $this) {
$warehouseId->setWarehouseId(null);
if ($stock->getWarehouse() === $this) {
$stock->setWarehouse(null);
}
}
return $this;
}
public function getPriority(): ?int
{
return $this->priority;
}
public function setPriority(int $priority): self
{
$this->priority = $priority;
return $this;
}
}