Source of file Departement.php

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

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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
<?php
namespace TIC\TownBundle\Entity;

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

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

/**
 * Département français.
 * @ORM\Table(name="tic_town_departement", indexes={
 *     @ORM\Index(name="nom_idx",    columns={"nom"}),
 * })
 * @ORM\Entity(repositoryClass=EntityRepo::class)
 */
class Departement
{
	use InseeTnccable;


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

	/**
	 * @ORM\Id
	 * @ORM\Column(type="string", length=3)
	 */
	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\ManyToOne(targetEntity="Region", inversedBy="departements")
	 * @ORM\JoinColumn(referencedColumnName="insee")
	 */
	private $region;

	/**
	 * @ORM\OneToMany(targetEntity="Commune", mappedBy="departement")
	 */
	private $communes;

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


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

	public function __construct()
	{
		$this->communes = 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(): ?string
	{
		return $this->insee;
	}

	public function setInsee($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 getRegion(): ?Region
	{
		return $this->region;
	}

	public function setRegion(?Region $region): self
	{
		$this->region = $region;

		return $this;
	}

	public function getCommunes(): ArrayCollection
	{
		return $this->communes;
	}

	public function addCommune(Commune $commune): self
	{
		if (!$this->communes->contains($commune)) {
			$this->communes[] = $commune;
			$commune->setDepartement($this);
		}

		return $this;
	}

	public function removeCommune(Commune $commune): self
	{
		if ($this->communes->contains($commune)) {
			$this->communes->removeElement($commune);
			// set the owning side to null (unless already changed)
			if ($commune->getDepartement() === $this) {
				$commune->setDepartement(null);
			}
		}

		return $this;
	}
}