<?php
namespace App\Entity;
use App\Repository\StdAdsZonesRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: StdAdsZonesRepository::class)]
#[ORM\Table(name: 'std_ads_zones')]
class StdAdsZones
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer', options: ['unsigned' => true])]
private ?int $id = null;
#[ORM\Column(name: 'machine_name', length: 100, unique: true)]
private string $machineName;
#[ORM\Column(length: 255)]
private string $name;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $description = null;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $width = null;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $height = null;
#[ORM\Column(length: 100, nullable: true)]
private ?string $position = null;
#[ORM\Column(type: 'boolean', options: ['default' => true])]
private bool $isActive = true;
#[ORM\Column(type: 'datetime', options: ['default' => 'CURRENT_TIMESTAMP'])]
private \DateTime $createdAt;
#[ORM\Column(type: 'datetime', options: ['default' => 'CURRENT_TIMESTAMP', 'on update' => 'CURRENT_TIMESTAMP'])]
private \DateTime $updatedAt;
public function __construct()
{
$now = new \DateTime();
$this->createdAt = $now;
$this->updatedAt = $now;
}
// ===========================
// GETTERS / SETTERS
// ===========================
public function getId(): ?int
{
return $this->id;
}
public function getMachineName(): string
{
return $this->machineName;
}
public function setMachineName(string $machineName): self
{
$this->machineName = $machineName;
return $this;
}
public function getName(): string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getWidth(): ?int
{
return $this->width;
}
public function setWidth(?int $width): self
{
$this->width = $width;
return $this;
}
public function getHeight(): ?int
{
return $this->height;
}
public function setHeight(?int $height): self
{
$this->height = $height;
return $this;
}
public function getPosition(): ?string
{
return $this->position;
}
public function setPosition(?string $position): self
{
$this->position = $position;
return $this;
}
public function isActive(): bool
{
return $this->isActive;
}
public function setIsActive(bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getCreatedAt(): \DateTime
{
return $this->createdAt;
}
public function setCreatedAt(\DateTime $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): \DateTime
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTime $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
// Convenience method
public function getSizeLabel(): string
{
return ($this->width && $this->height)
? sprintf('%dx%d', $this->width, $this->height)
: '-';
}
}