src/Entity/GroupeDemande.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\GroupeDemandeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Knp\DoctrineBehaviors\Contract\Entity\BlameableInterface;
  8. use Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface;
  9. use Knp\DoctrineBehaviors\Model\Blameable\BlameableTrait;
  10. use Knp\DoctrineBehaviors\Model\Timestampable\TimestampableTrait;
  11. #[ORM\Entity(repositoryClassGroupeDemandeRepository::class)]
  12. class GroupeDemande implements BlameableInterfaceTimestampableInterface
  13. {
  14.     use BlameableTrait;
  15.     use TimestampableTrait;
  16.     #[ORM\Id]
  17.     #[ORM\GeneratedValue]
  18.     #[ORM\Column]
  19.     private ?int $id null;
  20.     #[ORM\Column(length255)]
  21.     private ?string $name null;
  22.     #[ORM\ManyToOne(inversedBy'groupeDemandes')]
  23.     #[ORM\JoinColumn(nullablefalse)]
  24.     private ?Prestation $cycle null;
  25.     #[ORM\OneToMany(mappedBy'groupeDemande'targetEntityDemandeService::class)]
  26.     private Collection $demandes;
  27.     public function __construct()
  28.     {
  29.         $this->demandes = new ArrayCollection();
  30.     }
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getName(): ?string
  36.     {
  37.         return $this->name;
  38.     }
  39.     public function setName(string $name): self
  40.     {
  41.         $this->name $name;
  42.         return $this;
  43.     }
  44.     public function getCycle(): ?Prestation
  45.     {
  46.         return $this->cycle;
  47.     }
  48.     public function setCycle(?Prestation $cycle): self
  49.     {
  50.         $this->cycle $cycle;
  51.         return $this;
  52.     }
  53.     /**
  54.      * @return Collection<int, DemandeService>
  55.      */
  56.     public function getDemandes(): Collection
  57.     {
  58.         return $this->demandes;
  59.     }
  60.     public function addDemande(DemandeService $demande): self
  61.     {
  62.         if (!$this->demandes->contains($demande)) {
  63.             $this->demandes->add($demande);
  64.             $demande->setGroupeDemande($this);
  65.         }
  66.         return $this;
  67.     }
  68.     public function removeDemande(DemandeService $demande): self
  69.     {
  70.         if ($this->demandes->removeElement($demande)) {
  71.             // set the owning side to null (unless already changed)
  72.             if ($demande->getGroupeDemande() === $this) {
  73.                 $demande->setGroupeDemande(null);
  74.             }
  75.         }
  76.         return $this;
  77.     }
  78.     public function __toString(): string
  79.     {
  80.         return $this->name;
  81.     }
  82. }