<?php
namespace App\Entity;
use App\Repository\ParCondicionComercialRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ParCondicionComercialRepository::class)]
class ParCondicionComercial {
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $nombre = null;
#[ORM\OneToMany(mappedBy: 'condicionComercial', targetEntity: TerProveedor::class)]
private Collection $proveedor;
public function __toString(): string {
return $this->getNombre();
}
public function __construct() {
$this->proveedor = 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, TerProveedor>
*/
public function getProveedor(): Collection {
return $this->proveedor;
}
public function addProveedor(TerProveedor $proveedor): static {
if (!$this->proveedor->contains($proveedor)) {
$this->proveedor->add($proveedor);
$proveedor->setCondicionComercial($this);
}
return $this;
}
public function removeProveedor(TerProveedor $proveedor): static {
if ($this->proveedor->removeElement($proveedor)) {
// set the owning side to null (unless already changed)
if ($proveedor->getCondicionComercial() === $this) {
$proveedor->setCondicionComercial(null);
}
}
return $this;
}
}