src/Entity/LaBaseCategory.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LaBaseCategoryRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. #[ORM\Entity(repositoryClassLaBaseCategoryRepository::class)]
  8. class LaBaseCategory implements \Stringable
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'boolean')]
  15.     private bool $enabled false;
  16.     #[Assert\NotBlank]
  17.     #[ORM\Column(type'string'length255)]
  18.     private string $name;
  19.     #[ORM\Column(type'string')]
  20.     private string $color '#17a2b8';
  21.     /**
  22.      * @Gedmo\SortablePosition
  23.      */
  24.     #[ORM\Column]
  25.     private int $position 0;
  26.     #[ORM\Column(type'datetime'nullabletrue)]
  27.     private ?\DateTime $createdAt;
  28.     public function __construct()
  29.     {
  30.         $this->createdAt = new \DateTime();
  31.     }
  32.     public function getId(): ?int
  33.     {
  34.         return $this->id;
  35.     }
  36.     public function getName(): ?string
  37.     {
  38.         return $this->name;
  39.     }
  40.     public function setName(string $name): self
  41.     {
  42.         $this->name $name;
  43.         return $this;
  44.     }
  45.     public function getCreatedAt(): ?\DateTimeInterface
  46.     {
  47.         return $this->createdAt;
  48.     }
  49.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  50.     {
  51.         $this->createdAt $createdAt;
  52.         return $this;
  53.     }
  54.     public function __toString(): string
  55.     {
  56.         return $this->name;
  57.     }
  58.     public function isEnabled(): bool
  59.     {
  60.         return $this->enabled;
  61.     }
  62.     public function setEnabled(bool $enabled): void
  63.     {
  64.         $this->enabled $enabled;
  65.     }
  66.     public function getColor(): ?string
  67.     {
  68.         return $this->color;
  69.     }
  70.     public function setColor(?string $color): self
  71.     {
  72.         $this->color $color;
  73.         return $this;
  74.     }
  75.     public function getPosition(): ?int
  76.     {
  77.         return $this->position;
  78.     }
  79.     public function setPosition(int $position): self
  80.     {
  81.         $this->position $position;
  82.         return $this;
  83.     }
  84. }