src/Entity/Language.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LanguageRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=LanguageRepository::class)
  9.  */
  10. class Language
  11. {
  12.     const LANGUAGE_HU 1;
  13.     const LANGUAGE_RO 2;
  14.     const LANGUAGE_EN 3;
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255)
  23.      */
  24.     private $name;
  25.     /**
  26.      * @ORM\Column(type="string", length=255)
  27.      */
  28.     private $iso;
  29.     /**
  30.      * @ORM\OneToMany(targetEntity=Offer::class, mappedBy="language")
  31.      */
  32.     private $offers;
  33.     public function __construct()
  34.     {
  35.         $this->offers = new ArrayCollection();
  36.     }
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getName(): ?string
  42.     {
  43.         return $this->name;
  44.     }
  45.     public function setName(string $name): self
  46.     {
  47.         $this->name $name;
  48.         return $this;
  49.     }
  50.     public function getIso(): ?string
  51.     {
  52.         return $this->iso;
  53.     }
  54.     public function setIso(string $iso): self
  55.     {
  56.         $this->iso $iso;
  57.         return $this;
  58.     }
  59.     /**
  60.      * @return Collection<int, Offer>
  61.      */
  62.     public function getOffers(): Collection
  63.     {
  64.         return $this->offers;
  65.     }
  66.     public function addOffer(Offer $offer): self
  67.     {
  68.         if (!$this->offers->contains($offer)) {
  69.             $this->offers[] = $offer;
  70.             $offer->setLanguage($this);
  71.         }
  72.         return $this;
  73.     }
  74.     public function removeOffer(Offer $offer): self
  75.     {
  76.         if ($this->offers->removeElement($offer)) {
  77.             // set the owning side to null (unless already changed)
  78.             if ($offer->getLanguage() === $this) {
  79.                 $offer->setLanguage(null);
  80.             }
  81.         }
  82.         return $this;
  83.     }
  84. }