src/Entity/Tam/Tam.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Tam;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  7.  * Tam
  8.  *
  9.  * @ORM\Table(name="tam_tams")
  10.  * @ORM\Entity(repositoryClass="App\Repository\Tam\TamRepository")
  11.  * @ORM\HasLifecycleCallbacks
  12.  */
  13. class Tam
  14. {
  15.     /**
  16.      * @var int
  17.      *
  18.      * @ORM\Column(name="id", type="integer")
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue(strategy="IDENTITY")
  21.      */
  22.     private $id;
  23.     
  24.     /**
  25.      * @var integer
  26.      *
  27.      * @ORM\Column(name="old_id", type="integer", options={"default": 0}, nullable=true)
  28.      */
  29.     private $oldId;
  30.     
  31.     /**
  32.      * @var \App\Entity\Tam\TamType
  33.      *
  34.      * @ORM\ManyToOne(targetEntity="\App\Entity\Tam\TamType", fetch="EAGER", inversedBy="tams")
  35.      * @ORM\JoinColumns({
  36.      *   @ORM\JoinColumn(name="tam_type", referencedColumnName="id", onDelete="SET NULL")
  37.      * })
  38.      */
  39.     private $tamType;
  40.     
  41.     /**
  42.      * @ORM\OneToOne(targetEntity="App\Entity\Feed\FeedElement", inversedBy="tam", cascade={"persist", "remove"})
  43.      * @ORM\JoinColumn(name="feed_element", referencedColumnName="id",  onDelete="CASCADE", nullable=false)
  44.      */
  45.     private $feedElement;
  46.     
  47.     /**
  48.      * @var boolean
  49.      *
  50.      * @ORM\Column(name="in_club", type="boolean", options={"default": FALSE})
  51.      */
  52.     private $inClub;
  53.     
  54.     /**
  55.      * @var \App\Entity\Club\Club
  56.      *
  57.      * @ORM\ManyToOne(targetEntity="\App\Entity\Club\Club", fetch="EAGER", inversedBy="tams")
  58.      * @ORM\JoinColumns({
  59.      *   @ORM\JoinColumn(name="club", referencedColumnName="id", onDelete="SET NULL")
  60.      * })
  61.      */
  62.     private $club;
  63.     
  64.     /**
  65.      * @var \DateTime
  66.      *
  67.      * @ORM\Column(name="date_request", type="datetime", nullable=false)
  68.      */
  69.     private $dateRequest;
  70.     
  71.     
  72.     public function __construct()
  73.     {
  74.        
  75.         $this->inClub false;
  76.     }
  77.     /**
  78.      * Get id
  79.      *
  80.      * @return int
  81.      */
  82.     public function getId()
  83.     {
  84.         return $this->id;
  85.     }
  86.     
  87.     /**
  88.      * Set oldId
  89.      *
  90.      * @param integer $oldId
  91.      *
  92.      * @return Tam
  93.      */
  94.     public function setOldId($oldId)
  95.     {
  96.         $this->oldId $oldId;
  97.         return $this;
  98.     }
  99.     /**
  100.      * Get oldId
  101.      *
  102.      * @return integer
  103.      */
  104.     public function getOldId()
  105.     {
  106.         return $this->oldId;
  107.     }
  108.     
  109.     /**
  110.      * Set tamType
  111.      *
  112.      * @param TamType $tamType
  113.      *
  114.      * @return Tam
  115.      */
  116.     public function setTamType($tamType)
  117.     {
  118.         $this->tamType $tamType;
  119.         return $this;
  120.     }
  121.     /**
  122.      * Get tamType
  123.      *
  124.      * @return TamType
  125.      */
  126.     public function getTamType()
  127.     {
  128.         return $this->tamType;
  129.     }
  130.     
  131.     /**
  132.      * Set feedElement
  133.      *
  134.      * @param FeedElement $feedElement
  135.      *
  136.      * @return Tam
  137.      */
  138.     public function setFeedElement($feedElement)
  139.     {
  140.         $this->feedElement $feedElement;
  141.         $feedElement->setTam($this);
  142.         return $this;
  143.     }
  144.     /**
  145.      * Get feedElement
  146.      *
  147.      * @return FeedElement
  148.      */
  149.     public function getFeedElement()
  150.     {
  151.         return $this->feedElement;
  152.     }
  153.     
  154.     /**
  155.      * Set inClub
  156.      *
  157.      * @param boolean $inClub
  158.      *
  159.      * @return Tam
  160.      */
  161.     public function setInClub($inClub)
  162.     {
  163.         $this->inClub $inClub;
  164.         return $this;
  165.     }
  166.     /**
  167.      * Get inClub
  168.      *
  169.      * @return boolean
  170.      */
  171.     public function getInClub()
  172.     {
  173.         return $this->inClub;
  174.     }
  175.     
  176.     /**
  177.      * Set club
  178.      *
  179.      * @param Club $club
  180.      *
  181.      * @return Tam
  182.      */
  183.     public function setClub($club)
  184.     {
  185.         $this->club $club;
  186.         return $this;
  187.     }
  188.     /**
  189.      * Get club
  190.      *
  191.      * @return Club
  192.      */
  193.     public function getClub()
  194.     {
  195.         return $this->club;
  196.     }
  197.     
  198.     /**
  199.      * Set dateRequest
  200.      *
  201.      * @param \DateTime $dateRequest
  202.      *
  203.      * @return Tam
  204.      */
  205.     public function setDateRequest($dateRequest)
  206.     {
  207.         $this->dateRequest $dateRequest;
  208.         return $this;
  209.     }
  210.     /**
  211.      * Get dateRequest
  212.      *
  213.      * @return \DateTime
  214.      */
  215.     public function getDateRequest()
  216.     {
  217.         return $this->dateRequest;
  218.     }
  219.         
  220.     
  221.     /***********************
  222.      * Lifecycle Callbacks
  223.      ***********************/
  224.      
  225.     /**
  226.      *
  227.      * @ORM\PrePersist()
  228.      * @ORM\PreUpdate()
  229.      */
  230.     public function preUpdate()
  231.     {
  232.         //$this->setDateUpdated(new \DateTime());
  233.     }
  234.     
  235.     
  236.     /***********************
  237.      * OTHER FUNCTION
  238.      ***********************/
  239.      
  240.      
  241.      
  242.      public function getArrayForJson($schemeAndBaseURL$friend false){
  243.         $array = array();
  244.         $array['id'] = $this->getId();
  245.         $array['tamType'] = $this->getTamType()->getArrayForJson();
  246.         if($this->getDateRequest()){
  247.             $array['dateRequest'] = $this->getDateRequest()->format("Y-m-d\TH:i:sP");
  248.         }
  249.         $array['inClub'] = $this->getInClub();
  250.         
  251.         return $array;
  252.         
  253.     }
  254.     
  255.     
  256. }