<?php
namespace App\Entity\Tam;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Tam
*
* @ORM\Table(name="tam_tams")
* @ORM\Entity(repositoryClass="App\Repository\Tam\TamRepository")
* @ORM\HasLifecycleCallbacks
*/
class Tam
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var integer
*
* @ORM\Column(name="old_id", type="integer", options={"default": 0}, nullable=true)
*/
private $oldId;
/**
* @var \App\Entity\Tam\TamType
*
* @ORM\ManyToOne(targetEntity="\App\Entity\Tam\TamType", fetch="EAGER", inversedBy="tams")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="tam_type", referencedColumnName="id", onDelete="SET NULL")
* })
*/
private $tamType;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Feed\FeedElement", inversedBy="tam", cascade={"persist", "remove"})
* @ORM\JoinColumn(name="feed_element", referencedColumnName="id", onDelete="CASCADE", nullable=false)
*/
private $feedElement;
/**
* @var boolean
*
* @ORM\Column(name="in_club", type="boolean", options={"default": FALSE})
*/
private $inClub;
/**
* @var \App\Entity\Club\Club
*
* @ORM\ManyToOne(targetEntity="\App\Entity\Club\Club", fetch="EAGER", inversedBy="tams")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="club", referencedColumnName="id", onDelete="SET NULL")
* })
*/
private $club;
/**
* @var \DateTime
*
* @ORM\Column(name="date_request", type="datetime", nullable=false)
*/
private $dateRequest;
public function __construct()
{
$this->inClub = false;
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set oldId
*
* @param integer $oldId
*
* @return Tam
*/
public function setOldId($oldId)
{
$this->oldId = $oldId;
return $this;
}
/**
* Get oldId
*
* @return integer
*/
public function getOldId()
{
return $this->oldId;
}
/**
* Set tamType
*
* @param TamType $tamType
*
* @return Tam
*/
public function setTamType($tamType)
{
$this->tamType = $tamType;
return $this;
}
/**
* Get tamType
*
* @return TamType
*/
public function getTamType()
{
return $this->tamType;
}
/**
* Set feedElement
*
* @param FeedElement $feedElement
*
* @return Tam
*/
public function setFeedElement($feedElement)
{
$this->feedElement = $feedElement;
$feedElement->setTam($this);
return $this;
}
/**
* Get feedElement
*
* @return FeedElement
*/
public function getFeedElement()
{
return $this->feedElement;
}
/**
* Set inClub
*
* @param boolean $inClub
*
* @return Tam
*/
public function setInClub($inClub)
{
$this->inClub = $inClub;
return $this;
}
/**
* Get inClub
*
* @return boolean
*/
public function getInClub()
{
return $this->inClub;
}
/**
* Set club
*
* @param Club $club
*
* @return Tam
*/
public function setClub($club)
{
$this->club = $club;
return $this;
}
/**
* Get club
*
* @return Club
*/
public function getClub()
{
return $this->club;
}
/**
* Set dateRequest
*
* @param \DateTime $dateRequest
*
* @return Tam
*/
public function setDateRequest($dateRequest)
{
$this->dateRequest = $dateRequest;
return $this;
}
/**
* Get dateRequest
*
* @return \DateTime
*/
public function getDateRequest()
{
return $this->dateRequest;
}
/***********************
* Lifecycle Callbacks
***********************/
/**
*
* @ORM\PrePersist()
* @ORM\PreUpdate()
*/
public function preUpdate()
{
//$this->setDateUpdated(new \DateTime());
}
/***********************
* OTHER FUNCTION
***********************/
public function getArrayForJson($schemeAndBaseURL, $friend = false){
$array = array();
$array['id'] = $this->getId();
$array['tamType'] = $this->getTamType()->getArrayForJson();
if($this->getDateRequest()){
$array['dateRequest'] = $this->getDateRequest()->format("Y-m-d\TH:i:sP");
}
$array['inClub'] = $this->getInClub();
return $array;
}
}