src/Entity/PaymentMethod.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PaymentMethodRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassPaymentMethodRepository::class)]
  8. class PaymentMethod
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $name null;
  16.     #[ORM\Column(length255nullabletrue)]
  17.     private ?string $description null;
  18.     #[ORM\OneToMany(mappedBy'paymentMethod'targetEntityLivraisons::class)]
  19.     private Collection $livraisons;
  20.     #[ORM\OneToMany(mappedBy'paymentMethod'targetEntityUser::class)]
  21.     private Collection $users;
  22.     #[ORM\OneToMany(mappedBy'paymentMethod'targetEntitySouscription::class)]
  23.     private Collection $souscriptions;
  24.     public function __construct()
  25.     {
  26.         $this->livraisons = new ArrayCollection();
  27.         $this->users = new ArrayCollection();
  28.         $this->souscriptions = new ArrayCollection();
  29.     }
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getName(): ?string
  35.     {
  36.         return $this->name;
  37.     }
  38.     public function setName(string $name): static
  39.     {
  40.         $this->name $name;
  41.         return $this;
  42.     }
  43.     public function getDescription(): ?string
  44.     {
  45.         return $this->description;
  46.     }
  47.     public function setDescription(?string $description): static
  48.     {
  49.         $this->description $description;
  50.         return $this;
  51.     }
  52.     /**
  53.      * @return Collection<int, Livraisons>
  54.      */
  55.     public function getLivraisons(): Collection
  56.     {
  57.         return $this->livraisons;
  58.     }
  59.     public function addLivraison(Livraisons $livraison): static
  60.     {
  61.         if (!$this->livraisons->contains($livraison)) {
  62.             $this->livraisons->add($livraison);
  63.             $livraison->setPaymentMethod($this);
  64.         }
  65.         return $this;
  66.     }
  67.     public function removeLivraison(Livraisons $livraison): static
  68.     {
  69.         if ($this->livraisons->removeElement($livraison)) {
  70.             // set the owning side to null (unless already changed)
  71.             if ($livraison->getPaymentMethod() === $this) {
  72.                 $livraison->setPaymentMethod(null);
  73.             }
  74.         }
  75.         return $this;
  76.     }
  77.     /**
  78.      * @return Collection<int, User>
  79.      */
  80.     public function getUsers(): Collection
  81.     {
  82.         return $this->users;
  83.     }
  84.     public function addUser(User $user): static
  85.     {
  86.         if (!$this->users->contains($user)) {
  87.             $this->users->add($user);
  88.             $user->setPaymentMethod($this);
  89.         }
  90.         return $this;
  91.     }
  92.     public function removeUser(User $user): static
  93.     {
  94.         if ($this->users->removeElement($user)) {
  95.             // set the owning side to null (unless already changed)
  96.             if ($user->getPaymentMethod() === $this) {
  97.                 $user->setPaymentMethod(null);
  98.             }
  99.         }
  100.         return $this;
  101.     }
  102.     /**
  103.      * @return Collection<int, Souscription>
  104.      */
  105.     public function getSouscriptions(): Collection
  106.     {
  107.         return $this->souscriptions;
  108.     }
  109.     public function addSouscription(Souscription $souscription): static
  110.     {
  111.         if (!$this->souscriptions->contains($souscription)) {
  112.             $this->souscriptions->add($souscription);
  113.             $souscription->setPaymentMethod($this);
  114.         }
  115.         return $this;
  116.     }
  117.     public function removeSouscription(Souscription $souscription): static
  118.     {
  119.         if ($this->souscriptions->removeElement($souscription)) {
  120.             // set the owning side to null (unless already changed)
  121.             if ($souscription->getPaymentMethod() === $this) {
  122.                 $souscription->setPaymentMethod(null);
  123.             }
  124.         }
  125.         return $this;
  126.     }
  127. }