src/Entity/OrderItems.php line 13
<?phpnamespace App\Entity;use App\Repository\OrderItemsRepository;use DateTimeInterface;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: OrderItemsRepository::class)]class OrderItems{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\ManyToOne(inversedBy: 'orderItems')]#[ORM\JoinColumn(nullable: false)]private ?Order $command = null;#[ORM\Column]#[Assert\Type(type: 'integer')]#[Groups(['order:list', 'order:new'])]private ?int $quantity = 1;#[ORM\Column]#[Groups(['order:list'])]private ?float $amount = null;#[ORM\ManyToOne(cascade: ['persist', 'remove'], inversedBy: 'orderItems')]#[ORM\JoinColumn(nullable: false)]#[Groups(['order:list', 'order:new'])]private ?ArticleDepartment $article = null;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?DateTimeInterface $createdAt = null;public function __construct(){if (is_null($this->createdAt))$this->createdAt = new \DateTime();}public function getId(): ?int{return $this->id;}public function getCommand(): ?Order{return $this->command;}public function setCommand(?Order $command): self{$this->command = $command;return $this;}public function getQuantity(): ?int{return $this->quantity;}public function setQuantity(int $quantity): self{$this->quantity = $quantity;return $this;}public function getAmount(): ?float{if ($this->getController())return $this->getController();return $this->amount;}public function setAmount(float $amount): self{$this->amount = $amount;return $this;}public function getArticle(): ?ArticleDepartment{return $this->article;}public function setArticle(?ArticleDepartment $article): self{$this->article = $article;return $this;}public function getController(): float|bool{return $this->getArticle()->getController();}public function getCreatedAt(): ?DateTimeInterface{return $this->createdAt;}public function setCreatedAt(?DateTimeInterface $createdAt): self{$this->createdAt = $createdAt;return $this;}}