src/Entity/Tree.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\TimestampableTrait;
  4. use App\Repository\TreeRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=TreeRepository::class)
  10.  */
  11. class Tree
  12. {
  13.     use TimestampableTrait;
  14.     public const TREE_TYPE 0;
  15.     public const BUSH_AND_PLANT_TYPE 1;
  16.     public const INVASIVE_PLANT_TYPE 0;
  17.     public const ENDEMIQUE_PLANT_TYPE 1;
  18.     public const CATEGORIES_NAME = [
  19.         self::TREE_TYPE           => 'Arbre (+ 3 mètres)',
  20.         self::BUSH_AND_PLANT_TYPE => 'Arbuste / plante (- 3 mètres)',
  21.     ];
  22.     public const TYPE_NAME = [
  23.         self::INVASIVE_PLANT_TYPE  => 'Plante interdite',
  24.         self::ENDEMIQUE_PLANT_TYPE => 'Plante endémique',
  25.     ];
  26.     /**
  27.      * @ORM\Id
  28.      * @ORM\GeneratedValue
  29.      * @ORM\Column(type="integer")
  30.      */
  31.     private $id;
  32.     /**
  33.      * @ORM\Column(type="string", length=255)
  34.      */
  35.     private $latinName;
  36.     /**
  37.      * @ORM\Column(type="text")
  38.      */
  39.     private $description;
  40.     /**
  41.      * @ORM\Column(type="text")
  42.      */
  43.     private $characteristics;
  44.     /**
  45.      * @ORM\Column(type="string", length=255)
  46.      */
  47.     private $frenchName;
  48.     /**
  49.      * @ORM\Column(type="integer")
  50.      */
  51.     private $taxref;
  52.     /**
  53.      * @ORM\Column(type="boolean", nullable=true)
  54.      */
  55.     private $allowed;
  56.     /**
  57.      * @ORM\Column(type="string", length=255, nullable=true)
  58.      */
  59.     private $creoleName;
  60.     /**
  61.      * @ORM\Column(type="smallint")
  62.      */
  63.     private $category;
  64.     /**
  65.      * @ORM\OneToMany(targetEntity=TreeFile::class, mappedBy="tree", orphanRemoval=true, cascade={"persist"})
  66.      */
  67.     private $treeFiles;
  68.     /**
  69.      * @ORM\OneToMany(targetEntity=DemandTree::class, mappedBy="tree")
  70.      */
  71.     private $demandTrees;
  72.     /**
  73.      * @ORM\Column(type="integer", nullable=true)
  74.      */
  75.     private $stock;
  76.     /**
  77.      * @ORM\Column(type="smallint")
  78.      */
  79.     private $type self::INVASIVE_PLANT_TYPE;
  80.     public function __construct()
  81.     {
  82.         $this->treeFiles = new ArrayCollection();
  83.         $this->demandTrees = new ArrayCollection();
  84.     }
  85.     public function getId(): ?int
  86.     {
  87.         return $this->id;
  88.     }
  89.     public function getLatinName(): ?string
  90.     {
  91.         return $this->latinName;
  92.     }
  93.     public function setLatinName(string $latinName): self
  94.     {
  95.         $this->latinName $latinName;
  96.         return $this;
  97.     }
  98.     public function getDescription(): ?string
  99.     {
  100.         return $this->description;
  101.     }
  102.     public function setDescription(string $description): self
  103.     {
  104.         $this->description $description;
  105.         return $this;
  106.     }
  107.     public function getCharacteristics(): ?string
  108.     {
  109.         return $this->characteristics;
  110.     }
  111.     public function setCharacteristics(string $characteristics): self
  112.     {
  113.         $this->characteristics $characteristics;
  114.         return $this;
  115.     }
  116.     public function getFrenchName(): ?string
  117.     {
  118.         return $this->frenchName;
  119.     }
  120.     public function setFrenchName(string $frenchName): self
  121.     {
  122.         $this->frenchName $frenchName;
  123.         return $this;
  124.     }
  125.     public function getTaxref(): ?int
  126.     {
  127.         return $this->taxref;
  128.     }
  129.     public function setTaxref(int $taxref): self
  130.     {
  131.         $this->taxref $taxref;
  132.         return $this;
  133.     }
  134.     public function getAllowed(): ?bool
  135.     {
  136.         return $this->allowed;
  137.     }
  138.     public function setAllowed(bool $allowed): self
  139.     {
  140.         $this->allowed $allowed;
  141.         return $this;
  142.     }
  143.     public function getCreoleName(): ?string
  144.     {
  145.         return $this->creoleName;
  146.     }
  147.     public function setCreoleName(?string $creoleName): self
  148.     {
  149.         $this->creoleName $creoleName;
  150.         return $this;
  151.     }
  152.     public function getCategory(): ?int
  153.     {
  154.         return $this->category;
  155.     }
  156.     public function setCategory(int $category): self
  157.     {
  158.         $this->category $category;
  159.         return $this;
  160.     }
  161.     /**
  162.      * @return Collection|TreeFile[]
  163.      */
  164.     public function getTreeFiles(): Collection
  165.     {
  166.         return $this->treeFiles;
  167.     }
  168.     public function addTreeFile(TreeFile $treeFile): self
  169.     {
  170.         if (!$this->treeFiles->contains($treeFile)) {
  171.             $this->treeFiles[] = $treeFile;
  172.             $treeFile->setTree($this);
  173.         }
  174.         return $this;
  175.     }
  176.     public function removeTreeFile(TreeFile $treeFile): self
  177.     {
  178.         if ($this->treeFiles->removeElement($treeFile)) {
  179.             // set the owning side to null (unless already changed)
  180.             if ($treeFile->getTree() === $this) {
  181.                 $treeFile->setTree(null);
  182.             }
  183.         }
  184.         return $this;
  185.     }
  186.     /**
  187.      * @return Collection|DemandTree[]
  188.      */
  189.     public function getDemandTrees(): Collection
  190.     {
  191.         return $this->demandTrees;
  192.     }
  193.     public function addDemandTree(DemandTree $demandTree): self
  194.     {
  195.         if (!$this->demandTrees->contains($demandTree)) {
  196.             $this->demandTrees[] = $demandTree;
  197.             $demandTree->setTree($this);
  198.         }
  199.         return $this;
  200.     }
  201.     public function removeDemandTree(DemandTree $demandTree): self
  202.     {
  203.         if ($this->demandTrees->removeElement($demandTree)) {
  204.             // set the owning side to null (unless already changed)
  205.             if ($demandTree->getTree() === $this) {
  206.                 $demandTree->setTree(null);
  207.             }
  208.         }
  209.         return $this;
  210.     }
  211.     public function getStock(): ?int
  212.     {
  213.         return $this->stock;
  214.     }
  215.     public function setStock(?int $stock): self
  216.     {
  217.         $this->stock $stock;
  218.         return $this;
  219.     }
  220.     public function getType(): ?int
  221.     {
  222.         return $this->type;
  223.     }
  224.     public function setType(int $type): self
  225.     {
  226.         $this->type $type;
  227.         return $this;
  228.     }
  229. }