src/Entity/CategoriesEntreprises.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Trait\CreatedAtTrait;
  4. use App\Repository\CategoriesEntreprisesRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Entity(repositoryClassCategoriesEntreprisesRepository::class)]
  10. class CategoriesEntreprises
  11. {
  12.     use CreatedAtTrait;
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $name null;
  19.     /* #[ORM\Column(type: Types::TEXT)]
  20.     private ?string $description = null; */
  21.     #[ORM\Column(length255)]
  22.     private ?string $description null;
  23.     #[ORM\Column(length255)]
  24.     private ?string $slug null;
  25.     #[ORM\OneToMany(mappedBy'categoriesentreprises'targetEntityEntreprises::class)]
  26.     private Collection $entreprises;
  27.     public function __construct()
  28.     {
  29.         $this->entreprises = new ArrayCollection();
  30.         $this->created_at = new \DateTimeImmutable();
  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): static
  41.     {
  42.         $this->name $name;
  43.         return $this;
  44.     }
  45.     public function getDescription(): ?string
  46.     {
  47.         return $this->description;
  48.     }
  49.     public function setDescription(string $description): static
  50.     {
  51.         $this->description $description;
  52.         return $this;
  53.     }
  54.     public function getSlug(): ?string
  55.     {
  56.         return $this->slug;
  57.     }
  58.     public function setSlug(string $slug): static
  59.     {
  60.         $this->slug $slug;
  61.         return $this;
  62.     }
  63.     /**
  64.      * @return Collection<int, Entreprises>
  65.      */
  66.     public function getEntreprises(): Collection
  67.     {
  68.         return $this->entreprises;
  69.     }
  70.     public function addEntreprise(Entreprises $entreprise): static
  71.     {
  72.         if (!$this->entreprises->contains($entreprise)) {
  73.             $this->entreprises->add($entreprise);
  74.             $entreprise->setCategoriesentreprises($this);
  75.         }
  76.         return $this;
  77.     }
  78.     public function removeEntreprise(Entreprises $entreprise): static
  79.     {
  80.         if ($this->entreprises->removeElement($entreprise)) {
  81.             // set the owning side to null (unless already changed)
  82.             if ($entreprise->getCategoriesentreprises() === $this) {
  83.                 $entreprise->setCategoriesentreprises(null);
  84.             }
  85.         }
  86.         return $this;
  87.     }
  88. }