src/Entity/Surface.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. /**
  6.  * Surface
  7.  *
  8.  * @ORM\Table(name="tam_surfaces")
  9.  * @ORM\Entity(repositoryClass="App\Repository\SurfaceRepository")
  10.  */
  11. class Surface
  12. {
  13.     /**
  14.      * @var int
  15.      *
  16.      * @ORM\Column(name="id", type="integer")
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue(strategy="IDENTITY")
  19.      */
  20.     private $id;
  21.     
  22.     /**
  23.      * @var string
  24.      *
  25.      * @ORM\Column(name="label", type="string", length=255, nullable=true)
  26.      */
  27.     private $label;
  28.     
  29.     /**
  30.      * @var string
  31.      *
  32.      * @ORM\Column(name="code_translate", type="string", length=255, nullable=false)
  33.      */
  34.     private $codeTranslate;
  35.     
  36.     /**
  37.      * @var string
  38.      *
  39.      * @ORM\Column(name="description", type="text", nullable=true)
  40.      */
  41.     private $description;
  42.     
  43.     /**
  44.      * @var integer
  45.      *
  46.      * @ORM\Column(name="indice", type="integer", options={"default": 0})
  47.      */
  48.     private $indice;
  49.     
  50.     /**
  51.      * @var integer
  52.      *
  53.      * @ORM\Column(name="old_id", type="integer", options={"default": 0})
  54.      */
  55.     private $oldId;
  56.     
  57.     /**
  58.      * @var ArrayCollection
  59.      *
  60.      * @ORM\OneToMany(targetEntity="\App\Entity\Club\ClubSurface", mappedBy="surface", cascade={"persist", "remove"}, orphanRemoval=true)
  61.      */
  62.     private $clubSurfaces;
  63.     
  64.     /**
  65.      * @var ArrayCollection
  66.      *
  67.      * @ORM\OneToMany(targetEntity="\App\Entity\Event\EventClub", mappedBy="surface", cascade={"persist", "remove"}, orphanRemoval=true)
  68.      */
  69.     private $events;
  70.     
  71.     public function __construct()
  72.     {
  73.         $this->clubSurfaces = new ArrayCollection();
  74.         $this->events = new ArrayCollection();
  75.     }
  76.     /**
  77.      * Get id
  78.      *
  79.      * @return int
  80.      */
  81.     public function getId()
  82.     {
  83.         return $this->id;
  84.     }
  85.     
  86.     /**
  87.      * Set label
  88.      *
  89.      * @param string $label
  90.      *
  91.      * @return Surface
  92.      */
  93.     public function setLabel($label)
  94.     {
  95.         $this->label $label;
  96.         return $this;
  97.     }
  98.     /**
  99.      * Get label
  100.      *
  101.      * @return string
  102.      */
  103.     public function getLabel()
  104.     {
  105.         return $this->label;
  106.     }
  107.     
  108.     /**
  109.      * Set codeTranslate
  110.      *
  111.      * @param string $codeTranslate
  112.      *
  113.      * @return Surface
  114.      */
  115.     public function setCodeTranslate($codeTranslate)
  116.     {
  117.         $this->codeTranslate $codeTranslate;
  118.         return $this;
  119.     }
  120.     /**
  121.      * Get codeTranslate
  122.      *
  123.      * @return string
  124.      */
  125.     public function getCodeTranslate()
  126.     {
  127.         return $this->codeTranslate;
  128.     }
  129.     
  130.     /**
  131.      * Set description
  132.      *
  133.      * @param string $description
  134.      *
  135.      * @return Surface
  136.      */
  137.     public function setDescription($description)
  138.     {
  139.         $this->description $description;
  140.         return $this;
  141.     }
  142.     /**
  143.      * Get description
  144.      *
  145.      * @return string
  146.      */
  147.     public function getDescription()
  148.     {
  149.         return $this->description;
  150.     }
  151.     
  152.     
  153.     /**
  154.      * Set indice
  155.      *
  156.      * @param integer $indice
  157.      *
  158.      * @return Surface
  159.      */
  160.     public function setIndice($indice)
  161.     {
  162.         $this->indice $indice;
  163.         return $this;
  164.     }
  165.     /**
  166.      * Get indice
  167.      *
  168.      * @return integer
  169.      */
  170.     public function getIndice()
  171.     {
  172.         return $this->indice;
  173.     }
  174.     
  175.     /**
  176.      * Set oldId
  177.      *
  178.      * @param integer $oldId
  179.      *
  180.      * @return Surface
  181.      */
  182.     public function setOldId($oldId)
  183.     {
  184.         $this->oldId $oldId;
  185.         return $this;
  186.     }
  187.     /**
  188.      * Get oldId
  189.      *
  190.      * @return integer
  191.      */
  192.     public function getOldId()
  193.     {
  194.         return $this->oldId;
  195.     }
  196.     
  197.     /**
  198.      * Add clubSurface
  199.      *
  200.      * @param \App\Entity\Club\ClubSurface $clubSurface
  201.      *
  202.      * @return Surface
  203.      */
  204.     public function addClubSurface(\App\Entity\Club\ClubSurface $clubSurface)
  205.     {
  206.         $this->clubSurfaces[] = $clubSurface;
  207.         return $this;
  208.     }
  209.     /**
  210.      * Remove clubSurface
  211.      *
  212.      * @param \App\Entity\Club\ClubSurface $clubSurface
  213.      */
  214.     public function removeClubSurface(\App\Entity\Club\ClubSurface $clubSurface)
  215.     {
  216.         $this->clubSurfaces->removeElement($clubSurface);
  217.     }
  218.     /**
  219.      * Get clubSurfaces
  220.      *
  221.      * @return \Doctrine\Common\Collections\Collection
  222.      */
  223.     public function getClubSurfaces()
  224.     {
  225.         return $this->clubSurfaces;
  226.     }
  227.     
  228.     /**
  229.      * Add event
  230.      *
  231.      * @param \App\Entity\Event\EventClub $event
  232.      *
  233.      * @return Surface
  234.      */
  235.     public function addEvent(\App\Entity\Event\EventClub $event)
  236.     {
  237.         $this->events[] = $event;
  238.         return $this;
  239.     }
  240.     /**
  241.      * Remove event
  242.      *
  243.      * @param \App\Entity\Event\EventClub $event
  244.      */
  245.     public function removeEvent(\App\Entity\Event\EventClub $event)
  246.     {
  247.         $this->events->removeElement($event);
  248.     }
  249.     /**
  250.      * Get events
  251.      *
  252.      * @return \Doctrine\Common\Collections\Collection
  253.      */
  254.     public function getEvents()
  255.     {
  256.         return $this->events;
  257.     }
  258.     
  259.     
  260.     /***********************
  261.      * OTHER FUNCTION
  262.      ***********************/
  263.     
  264.     public function getArrayForJson(){
  265.         $array = array();
  266.         $array['id'] = $this->getId();
  267.         $array['label'] = $this->getLabel();
  268.         $array['codeTranslate'] = $this->getCodeTranslate();
  269.         
  270.         return $array;
  271.         
  272.     }
  273.     
  274.     
  275. }