src/Entity/LotConfiguration.php line 16
<?phpnamespace App\Entity;use App\Kimia;use App\Repository\LotConfigurationRepository;use App\Trait\DateTrait;use DateTimeImmutable;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: LotConfigurationRepository::class)]class LotConfiguration{use DateTrait;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $name = null;#[ORM\Column(nullable: true)]private ?int $sizeWidth = null;#[ORM\Column(nullable: true)]private ?int $sizeHeight = null;#[ORM\Column(nullable: true)]private ?int $qrSize = null;#[ORM\Column(nullable: true)]private ?int $qrPositionX = null;#[ORM\Column(nullable: true)]private ?int $qrPositionY = null;#[ORM\ManyToOne(cascade: ["persist", "remove"])]#[ORM\JoinColumn(nullable: false)]private ?Attachment $attachment = null;#[ORM\Column]private ?int $volume = null;#[ORM\Column(type: Types::SMALLINT, options: ["default" => Kimia::LOT_TICKET])]private ?int $type = null;#[ORM\OneToMany(mappedBy: 'configuration', targetEntity: Lot::class)]private Collection $lots;#[ORM\ManyToOne]#[ORM\JoinColumn(nullable: false)]private ?Establishment $establishment = null;#[ORM\ManyToOne(cascade: ["persist", "remove"])]private ?Attachment $qrAttachment = null;#[ORM\ManyToOne]#[ORM\JoinColumn(nullable: true)]private ?Article $article = null;#[ORM\Column(options: ["default" => false])]private ?bool $showName = false;#[ORM\Column(nullable: true)]private ?int $nameSize = null;#[ORM\Column(nullable: true)]private ?int $namePositionX = null;#[ORM\Column(nullable: true)]private ?int $namePositionY = null;public function __construct(){if (is_null($this->createdAt)) $this->createdAt = new DateTimeImmutable();$this->updatedAt = new DateTimeImmutable();$this->lots = 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 getSizeWidth(): ?int{return $this->sizeWidth;}public function setSizeWidth(int $sizeWidth): self{$this->sizeWidth = $sizeWidth;return $this;}public function getSizeHeight(): ?int{return $this->sizeHeight;}public function setSizeHeight(int $sizeHeight): self{$this->sizeHeight = $sizeHeight;return $this;}public function getQrSize(): ?int{return $this->qrSize;}public function setQrSize(int $qrSize): self{$this->qrSize = $qrSize;return $this;}public function getQrPositionX(): ?int{return $this->qrPositionX;}public function setQrPositionX(int $qrPositionX): self{$this->qrPositionX = $qrPositionX;return $this;}public function getQrPositionY(): ?int{return $this->qrPositionY;}public function setQrPositionY(int $qrPositionY): self{$this->qrPositionY = $qrPositionY;return $this;}public function getAttachment(): ?Attachment{return $this->attachment;}public function setAttachment(?Attachment $attachment): self{$this->attachment = $attachment;return $this;}public function getVolume(): ?int{return $this->volume;}public function setVolume(int $volume): self{$this->volume = $volume;return $this;}public function getType(): ?int{return $this->type;}public static function getTypes(): array{return ["Billet d'événément" => Kimia::LOT_TICKET,"Invitation" => Kimia::LOT_INVITATION,"QR Code" => Kimia::LOT_QR];}public function getTypeName(): ?string{return array_flip(self::getTypes())[$this->getType()];}public function setType(int $type): self{$this->type = $type;return $this;}/*** @return Collection<int, Lot>*/public function getLots(): Collection{return $this->lots;}public function addLot(Lot $lot): self{if (!$this->lots->contains($lot)) {$this->lots->add($lot);$lot->setConfiguration($this);}return $this;}public function removeLot(Lot $lot): self{if ($this->lots->removeElement($lot)) {// set the owning side to null (unless already changed)if ($lot->getConfiguration() === $this) {$lot->setConfiguration(null);}}return $this;}public function countTickets(): int{$count = 0;foreach ($this->getLots() as $lot)$count += $lot->getTickets()->count();return $count;}public function getEstablishment(): ?Establishment{return $this->establishment;}public function setEstablishment(?Establishment $establishment): self{$this->establishment = $establishment;return $this;}public function getQrAttachment(): ?Attachment{return $this->qrAttachment;}public function setQrAttachment(?Attachment $qrAttachment): self{$this->qrAttachment = $qrAttachment;return $this;}public function getArticle(): ?Article{return $this->article;}public function setArticle(?Article $article): self{$this->article = $article;return $this;}public function __toString(): string{return $this->name;}public function isShowName(): ?bool{return $this->showName;}public function setShowName(bool $showName): static{$this->showName = $showName;return $this;}public function getNameSize(): ?int{return $this->nameSize;}public function setNameSize(?int $nameSize): static{$this->nameSize = $nameSize;return $this;}public function getNamePositionX(): ?int{return $this->namePositionX;}public function setNamePositionX(?int $namePositionX): static{$this->namePositionX = $namePositionX;return $this;}public function getNamePositionY(): ?int{return $this->namePositionY;}public function setNamePositionY(?int $namePositionY): static{$this->namePositionY = $namePositionY;return $this;}}