src/Entity/ParFormaPago.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ParFormaPagoRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassParFormaPagoRepository::class)]
  8. class ParFormaPago {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column]
  12.     private ?int $id null;
  13.     #[ORM\Column(length255)]
  14.     private ?string $nombre null;
  15.     #[ORM\OneToMany(mappedBy'formaPago'targetEntityRFOrdenCompra::class)]
  16.     private Collection $ordenCompra;
  17.     public function __toString(): string {
  18.         return $this->getNombre();
  19.     }
  20.     public function __construct() {
  21.         $this->ordenCompra = new ArrayCollection();
  22.     }
  23.     public function getId(): ?int {
  24.         return $this->id;
  25.     }
  26.     public function getNombre(): ?string {
  27.         return $this->nombre;
  28.     }
  29.     public function setNombre(string $nombre): static {
  30.         $this->nombre $nombre;
  31.         return $this;
  32.     }
  33.     /**
  34.      * @return Collection<int, RFOrdenCompra>
  35.      */
  36.     public function getOrdenCompra(): Collection {
  37.         return $this->ordenCompra;
  38.     }
  39.     public function addOrdenCompra(RFOrdenCompra $ordenCompra): static {
  40.         if (!$this->ordenCompra->contains($ordenCompra)) {
  41.             $this->ordenCompra->add($ordenCompra);
  42.             $ordenCompra->setFormaPago($this);
  43.         }
  44.         return $this;
  45.     }
  46.     public function removeOrdenCompra(RFOrdenCompra $ordenCompra): static {
  47.         if ($this->ordenCompra->removeElement($ordenCompra)) {
  48.             // set the owning side to null (unless already changed)
  49.             if ($ordenCompra->getFormaPago() === $this) {
  50.                 $ordenCompra->setFormaPago(null);
  51.             }
  52.         }
  53.         return $this;
  54.     }
  55. }