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 extends BaseEntity
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255)]
  15.     private $name;
  16.     #[ORM\Column(type'string'length255nullabletrue)]
  17.     private $details;
  18.     #[ORM\OneToMany(mappedBy'paymentMethod'targetEntityPayment::class)]
  19.     private $payments;
  20.     public function __construct()
  21.     {
  22.         $this->payments = new ArrayCollection();
  23.     }
  24.     public function getId(): ?int
  25.     {
  26.         return $this->id;
  27.     }
  28.     public function getName(): ?string
  29.     {
  30.         return $this->name;
  31.     }
  32.     public function setName(string $name): self
  33.     {
  34.         $this->name $name;
  35.         return $this;
  36.     }
  37.     public function getDetails(): ?string
  38.     {
  39.         return $this->details;
  40.     }
  41.     public function setDetails(?string $details): self
  42.     {
  43.         $this->details $details;
  44.         return $this;
  45.     }
  46.     /**
  47.      * @return Collection<int, Payment>
  48.      */
  49.     public function getPayments(): Collection
  50.     {
  51.         return $this->payments;
  52.     }
  53.     public function addPayment(Payment $payment): self
  54.     {
  55.         if (!$this->payments->contains($payment)) {
  56.             $this->payments[] = $payment;
  57.             $payment->setPaymentMethod($this);
  58.         }
  59.         return $this;
  60.     }
  61.     public function removePayment(Payment $payment): self
  62.     {
  63.         if ($this->payments->removeElement($payment)) {
  64.             // set the owning side to null (unless already changed)
  65.             if ($payment->getPaymentMethod() === $this) {
  66.                 $payment->setPaymentMethod(null);
  67.             }
  68.         }
  69.         return $this;
  70.     }
  71. }