src/CmsBundle/Entity/Locale.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\CmsBundle\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\CmsBundle\Repository\LocaleRepository")
  8.  */
  9. class Locale
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=5)
  19.      */
  20.     private $title;
  21.     /**
  22.      * @ORM\ManyToMany(targetEntity="App\CmsBundle\Entity\Site", mappedBy="availableLocales")
  23.      */
  24.     private $availableSites;
  25.     public function __construct(string $locale)
  26.     {
  27.         $this->setTitle($locale);
  28.         $this->availableSites = new ArrayCollection();
  29.     }
  30.     public function __toString() : string
  31.     {
  32.         return $this->getTitle();
  33.     }
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getTitle(): ?string
  39.     {
  40.         return $this->title;
  41.     }
  42.     public function setTitle(string $title): self
  43.     {
  44.         $this->title $title;
  45.         return $this;
  46.     }
  47.     /**
  48.      * @return Collection|Site[]
  49.      */
  50.     public function getAvailableSites(): Collection
  51.     {
  52.         return $this->availableSites;
  53.     }
  54. }