src/Entity/StdAdsZones.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\StdAdsZonesRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassStdAdsZonesRepository::class)]
  6. #[ORM\Table(name'std_ads_zones')]
  7. class StdAdsZones
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer'options: ['unsigned' => true])]
  12.     private ?int $id null;
  13.     #[ORM\Column(name'machine_name'length100uniquetrue)]
  14.     private string $machineName;
  15.     #[ORM\Column(length255)]
  16.     private string $name;
  17.     #[ORM\Column(type'text'nullabletrue)]
  18.     private ?string $description null;
  19.     #[ORM\Column(type'integer'nullabletrue)]
  20.     private ?int $width null;
  21.     #[ORM\Column(type'integer'nullabletrue)]
  22.     private ?int $height null;
  23.     #[ORM\Column(length100nullabletrue)]
  24.     private ?string $position null;
  25.     #[ORM\Column(type'boolean'options: ['default' => true])]
  26.     private bool $isActive true;
  27.     #[ORM\Column(type'datetime'options: ['default' => 'CURRENT_TIMESTAMP'])]
  28.     private \DateTime $createdAt;
  29.     #[ORM\Column(type'datetime'options: ['default' => 'CURRENT_TIMESTAMP''on update' => 'CURRENT_TIMESTAMP'])]
  30.     private \DateTime $updatedAt;
  31.     public function __construct()
  32.     {
  33.         $now = new \DateTime();
  34.         $this->createdAt $now;
  35.         $this->updatedAt $now;
  36.     }
  37.     // ===========================
  38.     // GETTERS / SETTERS
  39.     // ===========================
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getMachineName(): string
  45.     {
  46.         return $this->machineName;
  47.     }
  48.     public function setMachineName(string $machineName): self
  49.     {
  50.         $this->machineName $machineName;
  51.         return $this;
  52.     }
  53.     public function getName(): string
  54.     {
  55.         return $this->name;
  56.     }
  57.     public function setName(string $name): self
  58.     {
  59.         $this->name $name;
  60.         return $this;
  61.     }
  62.     public function getDescription(): ?string
  63.     {
  64.         return $this->description;
  65.     }
  66.     public function setDescription(?string $description): self
  67.     {
  68.         $this->description $description;
  69.         return $this;
  70.     }
  71.     public function getWidth(): ?int
  72.     {
  73.         return $this->width;
  74.     }
  75.     public function setWidth(?int $width): self
  76.     {
  77.         $this->width $width;
  78.         return $this;
  79.     }
  80.     public function getHeight(): ?int
  81.     {
  82.         return $this->height;
  83.     }
  84.     public function setHeight(?int $height): self
  85.     {
  86.         $this->height $height;
  87.         return $this;
  88.     }
  89.     public function getPosition(): ?string
  90.     {
  91.         return $this->position;
  92.     }
  93.     public function setPosition(?string $position): self
  94.     {
  95.         $this->position $position;
  96.         return $this;
  97.     }
  98.     public function isActive(): bool
  99.     {
  100.         return $this->isActive;
  101.     }
  102.     public function setIsActive(bool $isActive): self
  103.     {
  104.         $this->isActive $isActive;
  105.         return $this;
  106.     }
  107.     public function getCreatedAt(): \DateTime
  108.     {
  109.         return $this->createdAt;
  110.     }
  111.     public function setCreatedAt(\DateTime $createdAt): self
  112.     {
  113.         $this->createdAt $createdAt;
  114.         return $this;
  115.     }
  116.     public function getUpdatedAt(): \DateTime
  117.     {
  118.         return $this->updatedAt;
  119.     }
  120.     public function setUpdatedAt(\DateTime $updatedAt): self
  121.     {
  122.         $this->updatedAt $updatedAt;
  123.         return $this;
  124.     }
  125.     // Convenience method
  126.     public function getSizeLabel(): string
  127.     {
  128.         return ($this->width && $this->height)
  129.             ? sprintf('%dx%d'$this->width$this->height)
  130.             : '-';
  131.     }
  132. }