src/Entity/LogHistoryCategory.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LogHistoryCategoryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\UX\Turbo\Attribute\Broadcast;
  8. #[ORM\Entity(repositoryClassLogHistoryCategoryRepository::class)]
  9. #[Broadcast]
  10. class LogHistoryCategory
  11. {
  12.     use IdentifiableTrait;
  13.     #[ORM\Column(length255)]
  14.     private ?string $name null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $slug null;
  17.     #[ORM\OneToMany(mappedBy'category'targetEntityLogHistory::class)]
  18.     private Collection $logHistories;
  19.     public function __construct()
  20.     {
  21.         $this->logHistories = new ArrayCollection();
  22.     }
  23.     public function getId(): ?int
  24.     {
  25.         return $this->id;
  26.     }
  27.     public function getName(): ?string
  28.     {
  29.         return $this->name;
  30.     }
  31.     public function setName(string $name): self
  32.     {
  33.         $this->name $name;
  34.         return $this;
  35.     }
  36.     public function getSlug(): ?string
  37.     {
  38.         return $this->slug;
  39.     }
  40.     public function setSlug(string $slug): self
  41.     {
  42.         $this->slug $slug;
  43.         return $this;
  44.     }
  45.     /**
  46.      * @return Collection<int, LogHistory>
  47.      */
  48.     public function getLogHistories(): Collection
  49.     {
  50.         return $this->logHistories;
  51.     }
  52.     public function addLogHistory(LogHistory $logHistory): self
  53.     {
  54.         if (!$this->logHistories->contains($logHistory)) {
  55.             $this->logHistories->add($logHistory);
  56.             $logHistory->setCategory($this);
  57.         }
  58.         return $this;
  59.     }
  60.     public function removeLogHistory(LogHistory $logHistory): self
  61.     {
  62.         if ($this->logHistories->removeElement($logHistory)) {
  63.             // set the owning side to null (unless already changed)
  64.             if ($logHistory->getCategory() === $this) {
  65.                 $logHistory->setCategory(null);
  66.             }
  67.         }
  68.         return $this;
  69.     }
  70. }