Source of file Region.php

Size: 3,341 Bytes - Last Modified: 2023-11-16T22:56:03+01:00

/home/websites/teicee/packagist/site/phpdoc/conf/../vendor/teicee/town-bundle/src/Entity/Region.php

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
<?php
namespace TIC\TownBundle\Entity;

use TIC\TownBundle\Repository\RegionRepository as EntityRepo;
use TIC\TownBundle\Traits\InseeTnccable;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * Région française.
 * @ORM\Table(name="tic_town_region", indexes={
 *     @ORM\Index(name="nom_idx",    columns={"nom"}),
 * })
 * @ORM\Entity(repositoryClass=EntityRepo::class)
 */
class Region
{
	use InseeTnccable;


// --------------------------------------------------------------------- Properties

	/**
	 * @ORM\Id
	 * @ORM\Column(type="smallint")
	 */
	private $insee;

	/**
	 * @ORM\Column(type="string", length=5, nullable=true)
	 */
	private $cheflieu;

	/**
	 * @ORM\Column(type="string", length=255)
	 */
	private $nom_maj;

	/**
	 * @ORM\Column(type="string", length=255)
	 */
	private $nom;

	/**
	 * @ORM\OneToMany(targetEntity="Departement", mappedBy="region")
	 */
	private $departements;

	/**
	 * @ORM\Column(type="boolean")
	 */
	private $enabled;
	
    /**
	 * @ORM\Column(type="boolean")
	 */
	private $outre_mer;


// --------------------------------------------------------------------- Custom methods

	public function __construct()
	{
		$this->departements = new ArrayCollection();
		$this->enabled = true;
		$this->outre_mer = false;
	}

	public function __toString()
	{
#		return $this->getArtNom();
		return $this->getNomArt();
	}


// --------------------------------------------------------------------- Shortcut methods


// --------------------------------------------------------------------- Tweaked methods


// --------------------------------------------------------------------- Auto-generated

	public function getInsee(): ?int
	{
		return $this->insee;
	}

	public function setInsee(?int $insee)
	{
		$this->insee = $insee;

		return $this;
	}

	public function getCheflieu(): ?string
	{
		return $this->cheflieu;
	}

	public function setCheflieu(?string $cheflieu): self
	{
		$this->cheflieu = $cheflieu;

		return $this;
	}

	public function getNomMaj(): ?string
	{
		return $this->nom_maj;
	}

	public function setNomMaj(string $nom_maj): self
	{
		$this->nom_maj = $nom_maj;

		return $this;
	}

	public function getNom(): ?string
	{
		return $this->nom;
	}

	public function setNom(string $nom): self
	{
		$this->nom = $nom;

		return $this;
	}

	public function getEnabled(): ?bool
	{
		return $this->enabled;
	}

	public function setEnabled(bool $enabled): self
	{
		$this->enabled = $enabled;

		return $this;
	}
	
    public function getOutreMer(): ?bool
	{
		return $this->outre_mer;
	}

	public function setOutreMer(bool $outre_mer): self
	{
		$this->outre_mer = $outre_mer;

		return $this;
	}

	public function getDepartements(): ArrayCollection
	{
		return $this->departements;
	}

	public function addDepartement(Departement $departement): self
	{
		if (!$this->departements->contains($departement)) {
			$this->departements[] = $departement;
			$departement->setRegion($this);
		}

		return $this;
	}

	public function removeDepartement(Departement $departement): self
	{
		if ($this->departements->contains($departement)) {
			$this->departements->removeElement($departement);
			// set the owning side to null (unless already changed)
			if ($departement->getRegion() === $this) {
				$departement->setRegion(null);
			}
		}

		return $this;
	}
}