<?php
namespace App\Entity;
use App\Repository\ContractRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ContractRepository::class)]
class Contract
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private ?string $name = null;
#[ORM\Column(type: 'string', length: 255)]
private ?string $nameDisplay = null;
#[ORM\Column(type: 'integer', nullable: true, options: ['default' => 0])]
private ?int $ordering = null;
#[ORM\Column(type: 'boolean', nullable: true, options: ['default' => 0])]
private ?bool $status = null;
#[ORM\OneToMany(targetEntity: Offer::class, mappedBy: 'contract')]
private Collection $offers;
public function __construct()
{
$this->offers = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getNameDisplay(): ?string
{
return $this->nameDisplay;
}
public function setNameDisplay(string $nameDisplay): self
{
$this->nameDisplay = $nameDisplay;
return $this;
}
public function getOrdering(): ?int
{
return $this->ordering;
}
public function setOrdering(?int $ordering): self
{
$this->ordering = $ordering;
return $this;
}
public function getStatus(): ?bool
{
return $this->status;
}
public function setStatus(?bool $status): self
{
$this->status = $status;
return $this;
}
/**
* @return Collection<int, Offer>
*/
public function getOffers(): Collection
{
return $this->offers;
}
public function addOffer(Offer $offer): self
{
if (!$this->offers->contains($offer)) {
$this->offers[] = $offer;
$offer->setContract($this);
}
return $this;
}
public function removeOffer(Offer $offer): self
{
if ($this->offers->removeElement($offer)) {
// set the owning side to null (unless already changed)
if ($offer->getContract() === $this) {
$offer->setContract(null);
}
}
return $this;
}
}