This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use App\Repository\OrderRepository;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
@@ -14,6 +16,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
* 2 = Bestellung in Bearbeitung
|
||||
* 3 = Bestellung versendet
|
||||
*/
|
||||
|
||||
#[ORM\Entity(repositoryClass: OrderRepository::class)]
|
||||
#[ORM\Table(name: '`order`')]
|
||||
#[ApiResource]
|
||||
@@ -22,9 +25,12 @@ class Order
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
#[ApiProperty(identifier: false)]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
#[ORM\Column(length: 255,unique: true)]
|
||||
#[ApiProperty(identifier: true)]
|
||||
|
||||
private ?string $orderId = null;
|
||||
|
||||
#[ORM\Column]
|
||||
@@ -33,8 +39,8 @@ class Order
|
||||
#[ORM\Column]
|
||||
private array $data = [];
|
||||
|
||||
#[ORM\Column(name: 'change_date',type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||
private ?\DateTimeInterface $changeDate = null;
|
||||
#[ORM\Column(name: 'change_date', type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||
private ?DateTimeInterface $changeDate = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
@@ -77,12 +83,12 @@ class Order
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getChangeDate(): ?\DateTimeInterface
|
||||
public function getChangeDate(): ?DateTimeInterface
|
||||
{
|
||||
return $this->changeDate;
|
||||
}
|
||||
|
||||
public function setChangeDate(\DateTimeInterface $changeDate): static
|
||||
public function setChangeDate(DateTimeInterface $changeDate): static
|
||||
{
|
||||
$this->changeDate = $changeDate;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use App\Repository\ProductRepository;
|
||||
use App\Repository\StockRepository;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
@@ -21,7 +21,7 @@ class Product
|
||||
private ?string $gtin = null;
|
||||
|
||||
#[ORM\Column(name: 'update_time', type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||
private ?\DateTimeInterface $updateTime = null;
|
||||
private ?DateTimeInterface $updateTime = null;
|
||||
|
||||
|
||||
public function getId(): ?int
|
||||
@@ -41,12 +41,12 @@ class Product
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUpdateTime(): ?\DateTimeInterface
|
||||
public function getUpdateTime(): ?DateTimeInterface
|
||||
{
|
||||
return $this->updateTime;
|
||||
}
|
||||
|
||||
public function setUpdateTime(\DateTimeInterface $updateTime): self
|
||||
public function setUpdateTime(DateTimeInterface $updateTime): self
|
||||
{
|
||||
$this->updateTime = $updateTime;
|
||||
|
||||
|
||||
@@ -3,16 +3,17 @@
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\StockRepository;
|
||||
#use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
use DateTimeInterface;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
#[ORM\Entity(repositoryClass: StockRepository::class)]
|
||||
#[ORM\UniqueEntity(['warehouse_id', 'product_id'])]
|
||||
#[ORM\UniqueConstraint(
|
||||
name: 'UNIQ_D34A04ADDCD6110',
|
||||
columns: ['warehouse_id', 'product_id']
|
||||
name: 'UNIQ_D34A04ADDCD6110',
|
||||
columns: ['warehouse_id', 'product_id']
|
||||
)]
|
||||
class Stock
|
||||
{
|
||||
@@ -29,19 +30,19 @@ class Stock
|
||||
#[ORM\ManyToOne(inversedBy: 'stocks')]
|
||||
private ?Warehouse $warehouse = null;
|
||||
|
||||
#[ORM\Column(name: 'update_time',type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||
private ?\DateTimeInterface $update_time = null;
|
||||
|
||||
#[ORM\Column(name: 'update_time', type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||
private ?DateTimeInterface $update_time = null;
|
||||
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(int $id): ?self
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getInstock(): ?int
|
||||
@@ -55,6 +56,7 @@ class Stock
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getProductId(): ?int
|
||||
{
|
||||
return $this->product_id;
|
||||
@@ -66,6 +68,7 @@ class Stock
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getWarehouseId(): ?int
|
||||
{
|
||||
return $this->warehouse_id;
|
||||
@@ -112,12 +115,12 @@ class Stock
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUpdateTime(): ?\DateTimeInterface
|
||||
public function getUpdateTime(): ?DateTimeInterface
|
||||
{
|
||||
return $this->update_time;
|
||||
}
|
||||
|
||||
public function setUpdateTime(?\DateTimeInterface $update_time): self
|
||||
public function setUpdateTime(?DateTimeInterface $update_time): self
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ class Warehouse
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(int $id): self
|
||||
{
|
||||
$this->id = $id;
|
||||
@@ -92,4 +93,4 @@ class Warehouse
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user