src/Entity/Valorization.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Trait\isActif;
  4. use App\Repository\ValorizationRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ValorizationRepository::class)
  10.  */
  11. class Valorization
  12. {
  13.     use isActif;
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255)
  22.      */
  23.     private $name;
  24.     /**
  25.      * @ORM\OneToMany(targetEntity=Contract::class, mappedBy="valorization")
  26.      */
  27.     private $contracts;
  28.     public function __construct()
  29.     {
  30.         $this->contracts = new ArrayCollection();
  31.     }
  32.     public function getId(): ?int
  33.     {
  34.         return $this->id;
  35.     }
  36.     public function getName(): ?string
  37.     {
  38.         return $this->name;
  39.     }
  40.     public function setName(string $name): self
  41.     {
  42.         $this->name $name;
  43.         return $this;
  44.     }
  45.     /**
  46.      * @return Collection|Contract[]
  47.      */
  48.     public function getContracts(): Collection
  49.     {
  50.         return $this->contracts;
  51.     }
  52.     public function addContract(Contract $contract): self
  53.     {
  54.         if (! $this->contracts->contains($contract)) {
  55.             $this->contracts[] = $contract;
  56.             $contract->setValorization($this);
  57.         }
  58.         return $this;
  59.     }
  60.     public function removeContract(Contract $contract): self
  61.     {
  62.         if ($this->contracts->removeElement($contract)) {
  63.             // set the owning side to null (unless already changed)
  64.             if ($contract->getValorization() === $this) {
  65.                 $contract->setValorization(null);
  66.             }
  67.         }
  68.         return $this;
  69.     }
  70.     public function __toString(): string
  71.     {
  72.         return $this->name;
  73.     }
  74. }