src/Entity/Offre.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\OffreRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassOffreRepository::class)]
  9. class Offre
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $nom null;
  17.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  18.     private ?string $description null;
  19.     #[ORM\Column(typeTypes::DECIMALprecision10scale'0'nullabletrue)]
  20.     private ?string $prix null;
  21.     #[ORM\OneToMany(mappedBy'offre'targetEntityUser::class)]
  22.     private Collection $users;
  23.     public function __construct()
  24.     {
  25.         $this->users = new ArrayCollection();
  26.     }
  27.     public function getId(): ?int
  28.     {
  29.         return $this->id;
  30.     }
  31.     public function getNom(): ?string
  32.     {
  33.         return $this->nom;
  34.     }
  35.     public function setNom(string $nom): static
  36.     {
  37.         $this->nom $nom;
  38.         return $this;
  39.     }
  40.     public function getDescription(): ?string
  41.     {
  42.         return $this->description;
  43.     }
  44.     public function setDescription(?string $description): static
  45.     {
  46.         $this->description $description;
  47.         return $this;
  48.     }
  49.     public function getPrix(): ?string
  50.     {
  51.         return $this->prix;
  52.     }
  53.     public function setPrix(?string $prix): static
  54.     {
  55.         $this->prix $prix;
  56.         return $this;
  57.     }
  58.     /**
  59.      * @return Collection<int, User>
  60.      */
  61.     public function getUsers(): Collection
  62.     {
  63.         return $this->users;
  64.     }
  65.     public function addUser(User $user): static
  66.     {
  67.         if (!$this->users->contains($user)) {
  68.             $this->users->add($user);
  69.             $user->setOffre($this);
  70.         }
  71.         return $this;
  72.     }
  73.     public function removeUser(User $user): static
  74.     {
  75.         if ($this->users->removeElement($user)) {
  76.             // set the owning side to null (unless already changed)
  77.             if ($user->getOffre() === $this) {
  78.                 $user->setOffre(null);
  79.             }
  80.         }
  81.         return $this;
  82.     }
  83. }