src/Entity/Player/PlayerType.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Player;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. /**
  6.  * PlayerType
  7.  *
  8.  * @ORM\Table(name="tam_player_type")
  9.  * @ORM\Entity(repositoryClass="App\Repository\Player\PlayerTypeRepository")
  10.  */
  11. class PlayerType
  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\Player\Player", mappedBy="playerType", cascade={"persist"}, orphanRemoval=true)
  61.      */
  62.     private $players;
  63.     
  64.     
  65.     public function __construct()
  66.     {
  67.         $this->players = new ArrayCollection();
  68.      
  69.     }
  70.     /**
  71.      * Get id
  72.      *
  73.      * @return int
  74.      */
  75.     public function getId()
  76.     {
  77.         return $this->id;
  78.     }
  79.     
  80.     /**
  81.      * Set label
  82.      *
  83.      * @param string $label
  84.      *
  85.      * @return PlayerType
  86.      */
  87.     public function setLabel($label)
  88.     {
  89.         $this->label $label;
  90.         return $this;
  91.     }
  92.     /**
  93.      * Get label
  94.      *
  95.      * @return string
  96.      */
  97.     public function getLabel()
  98.     {
  99.         return $this->label;
  100.     }
  101.     
  102.     /**
  103.      * Set codeTranslate
  104.      *
  105.      * @param string $codeTranslate
  106.      *
  107.      * @return PlayerType
  108.      */
  109.     public function setCodeTranslate($codeTranslate)
  110.     {
  111.         $this->codeTranslate $codeTranslate;
  112.         return $this;
  113.     }
  114.     /**
  115.      * Get codeTranslate
  116.      *
  117.      * @return string
  118.      */
  119.     public function getCodeTranslate()
  120.     {
  121.         return $this->codeTranslate;
  122.     }
  123.     
  124.     /**
  125.      * Set description
  126.      *
  127.      * @param string $description
  128.      *
  129.      * @return PlayerType
  130.      */
  131.     public function setDescription($description)
  132.     {
  133.         $this->description $description;
  134.         return $this;
  135.     }
  136.     /**
  137.      * Get description
  138.      *
  139.      * @return string
  140.      */
  141.     public function getDescription()
  142.     {
  143.         return $this->description;
  144.     }
  145.     
  146.     
  147.     /**
  148.      * Set indice
  149.      *
  150.      * @param integer $indice
  151.      *
  152.      * @return PlayerType
  153.      */
  154.     public function setIndice($indice)
  155.     {
  156.         $this->indice $indice;
  157.         return $this;
  158.     }
  159.     /**
  160.      * Get indice
  161.      *
  162.      * @return integer
  163.      */
  164.     public function getIndice()
  165.     {
  166.         return $this->indice;
  167.     }
  168.     
  169.     /**
  170.      * Set oldId
  171.      *
  172.      * @param integer $oldId
  173.      *
  174.      * @return PlayerType
  175.      */
  176.     public function setOldId($oldId)
  177.     {
  178.         $this->oldId $oldId;
  179.         return $this;
  180.     }
  181.     /**
  182.      * Get oldId
  183.      *
  184.      * @return integer
  185.      */
  186.     public function getOldId()
  187.     {
  188.         return $this->oldId;
  189.     }
  190.     
  191.     /**
  192.      * Add player
  193.      *
  194.      * @param \App\Entity\Player\Player $player
  195.      *
  196.      * @return PlayerType
  197.      */
  198.     public function addPlayer(\App\Entity\Player\Player $player)
  199.     {
  200.         $this->players[] = $player;
  201.         return $this;
  202.     }
  203.     /**
  204.      * Remove player
  205.      *
  206.      * @param \App\Entity\Player\Player $player
  207.      */
  208.     public function removePlayer(\App\Entity\Player\Player $player)
  209.     {
  210.         $this->players->removeElement($player);
  211.     }
  212.     /**
  213.      * Get players
  214.      *
  215.      * @return \Doctrine\Common\Collections\Collection
  216.      */
  217.     public function getPlayers()
  218.     {
  219.         return $this->players;
  220.     }
  221.     
  222.     /***********************
  223.      * OTHER FUNCTION
  224.      ***********************/
  225.     
  226.     public function getArrayForJson(){
  227.         $array = array();
  228.         $array['id'] = $this->getId();
  229.         $array['label'] = $this->getLabel();
  230.         $array['codeTranslate'] = $this->getCodeTranslate();
  231.         
  232.         return $array;
  233.         
  234.     }
  235.     
  236.     
  237. }