src/Entity/CategoriesImmobiliers.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Trait\CreatedAtTrait;
  4. use App\Repository\CategoriesImmobiliersRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassCategoriesImmobiliersRepository::class)]
  9. class CategoriesImmobiliers
  10. {
  11.     use CreatedAtTrait;
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255)]
  17.     private ?string $name null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $description null;
  20.     #[ORM\Column(length255)]
  21.     private ?string $statut null;
  22.     #[ORM\Column(length255)]
  23.     private ?string $slug null;
  24.             /*
  25.     #[ORM\Column]
  26.     private ?\DateTimeImmutable $createdAt = null;
  27.             */
  28.     #[ORM\OneToMany(mappedBy'categoriesimmobiliers'targetEntityImmobiliers::class)]
  29.     private Collection $immobiliers;
  30.     public function __construct()
  31.     {
  32.         $this->immobiliers = new ArrayCollection();
  33.         $this->created_at = new \DateTimeImmutable();
  34.         /// $this->createdAt = new \DateTimeImmutable(); /////////////////
  35.     }
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getName(): ?string
  41.     {
  42.         return $this->name;
  43.     }
  44.     public function setName(string $name): static
  45.     {
  46.         $this->name $name;
  47.         return $this;
  48.     }
  49.     public function getDescription(): ?string
  50.     {
  51.         return $this->description;
  52.     }
  53.     public function setDescription(string $description): static
  54.     {
  55.         $this->description $description;
  56.         return $this;
  57.     }
  58.     public function getStatut(): ?string
  59.     {
  60.         return $this->statut;
  61.     }
  62.     public function setStatut(string $statut): static
  63.     {
  64.         $this->statut $statut;
  65.         return $this;
  66.     }
  67.     public function getSlug(): ?string
  68.     {
  69.         return $this->slug;
  70.     }
  71.     public function setSlug(string $slug): static
  72.     {
  73.         $this->slug $slug;
  74.         return $this;
  75.     }
  76.     /**
  77.      * @return Collection<int, Immobiliers>
  78.      */
  79.     public function getImmobiliers(): Collection
  80.     {
  81.         return $this->immobiliers;
  82.     }
  83.     public function addImmobilier(Immobiliers $immobilier): static
  84.     {
  85.         if (!$this->immobiliers->contains($immobilier)) {
  86.             $this->immobiliers->add($immobilier);
  87.             $immobilier->setCategoriesimmobiliers($this);
  88.         }
  89.         return $this;
  90.     }
  91.     public function removeImmobilier(Immobiliers $immobilier): static
  92.     {
  93.         if ($this->immobiliers->removeElement($immobilier)) {
  94.             // set the owning side to null (unless already changed)
  95.             if ($immobilier->getCategoriesimmobiliers() === $this) {
  96.                 $immobilier->setCategoriesimmobiliers(null);
  97.             }
  98.         }
  99.         return $this;
  100.     }
  101. }