src/Entity/Promotion.php line 15
<?phpnamespace App\Entity;use App\Kimia;use App\Repository\PromotionRepository;use App\Trait\ActivableTrait;use App\Trait\DateTrait;use DateTimeImmutable;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: PromotionRepository::class)]class Promotion{use DateTrait;use ActivableTrait;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $name = null;#[ORM\ManyToOne(cascade: ['persist'])]private ?Attachment $thumbnail = null;#[ORM\Column]private ?float $margin = null;#[ORM\Column(nullable: true)]private ?int $nbrLimit = null;#[ORM\ManyToOne(inversedBy: 'promotions')]#[ORM\JoinColumn(nullable: false)]private ?Establishment $establishment = null;#[ORM\ManyToOne(inversedBy: 'promotions')]#[ORM\JoinColumn(nullable: false)]private ?ArticleDepartment $article = null;#[ORM\Column]private ?bool $isPromote = null;#[ORM\OneToMany(mappedBy: 'promotion', targetEntity: Order::class)]private Collection $orders;#[ORM\Column(length: 255)]private ?string $code = null;public function __construct(){$this->isActive = Kimia::ACTIVE;if (is_null($this->createdAt)) $this->createdAt = new DateTimeImmutable();$this->updatedAt = new DateTimeImmutable();$this->orders = new ArrayCollection();}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 getThumbnail(): ?Attachment{return $this->thumbnail;}public function setThumbnail(?Attachment $thumbnail): self{$this->thumbnail = $thumbnail;return $this;}public function getNbrLimit(): ?int{return $this->nbrLimit;}public function setNbrLimit(?int $nbrLimit): self{$this->nbrLimit = $nbrLimit;return $this;}public function getEstablishment(): ?Establishment{return $this->establishment;}public function setEstablishment(?Establishment $establishment): self{$this->establishment = $establishment;return $this;}public function getArticle(): ?ArticleDepartment{return $this->article;}public function setArticle(?ArticleDepartment $article): self{$this->article = $article;return $this;}public function isIsPromote(): ?bool{return $this->isPromote;}public function setIsPromote(bool $isPromote): self{$this->isPromote = $isPromote;return $this;}public function getMargin(): ?float{return $this->margin;}public function setMargin(float $margin): self{$this->margin = $margin;return $this;}/*** @return Collection<int, Order>*/public function getOrders(): Collection{return $this->orders;}public function addOrder(Order $order): self{if (!$this->orders->contains($order)) {$this->orders->add($order);$order->setPromotion($this);}return $this;}public function removeOrder(Order $order): self{if ($this->orders->removeElement($order)) {// set the owning side to null (unless already changed)if ($order->getPromotion() === $this) {$order->setPromotion(null);}}return $this;}public function getCode(): ?string{return $this->code;}public function setCode(string $code): self{$this->code = $code;return $this;}}