<?php
namespace App\Entity;
use App\Entity\Trait\isActif;
use App\Repository\ValorizationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ValorizationRepository::class)
*/
class Valorization
{
use isActif;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity=Contract::class, mappedBy="valorization")
*/
private $contracts;
public function __construct()
{
$this->contracts = 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;
}
/**
* @return Collection|Contract[]
*/
public function getContracts(): Collection
{
return $this->contracts;
}
public function addContract(Contract $contract): self
{
if (! $this->contracts->contains($contract)) {
$this->contracts[] = $contract;
$contract->setValorization($this);
}
return $this;
}
public function removeContract(Contract $contract): self
{
if ($this->contracts->removeElement($contract)) {
// set the owning side to null (unless already changed)
if ($contract->getValorization() === $this) {
$contract->setValorization(null);
}
}
return $this;
}
public function __toString(): string
{
return $this->name;
}
}