<?php
namespace App\Entity;
use App\Repository\ParAccionNovedadRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ParAccionNovedadRepository::class)]
class ParAccionNovedad {
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $nombre = null;
#[ORM\OneToMany(mappedBy: 'accionNovedad', targetEntity: RFOrdenCompra::class)]
private Collection $ordenCompra;
public function __toString(): string {
return $this->getNombre();
}
public function __construct() {
$this->ordenCompra = new ArrayCollection();
}
public function getId(): ?int {
return $this->id;
}
public function getNombre(): ?string {
return $this->nombre;
}
public function setNombre(string $nombre): static {
$this->nombre = $nombre;
return $this;
}
/**
* @return Collection<int, RFOrdenCompra>
*/
public function getOrdenCompra(): Collection {
return $this->ordenCompra;
}
public function addOrdenCompra(RFOrdenCompra $ordenCompra): static {
if (!$this->ordenCompra->contains($ordenCompra)) {
$this->ordenCompra->add($ordenCompra);
$ordenCompra->setAccionNovedad($this);
}
return $this;
}
public function removeOrdenCompra(RFOrdenCompra $ordenCompra): static {
if ($this->ordenCompra->removeElement($ordenCompra)) {
// set the owning side to null (unless already changed)
if ($ordenCompra->getAccionNovedad() === $this) {
$ordenCompra->setAccionNovedad(null);
}
}
return $this;
}
}