<?php
namespace App\Entity\Club;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\Common\Collections\ArrayCollection;
/**
* Club
*
* @ORM\Table(name="tam_clubs")
* @ORM\Entity(repositoryClass="App\Repository\Club\ClubRepository")
* @ORM\HasLifecycleCallbacks
*/
class Club
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @ORM\OneToOne(targetEntity="App\Entity\User", inversedBy="club", cascade={"persist", "remove"})
* @ORM\JoinColumn(name="tam_user", referencedColumnName="id", onDelete="CASCADE", nullable=false)
*/
private $user;
/**
* @var string
*
* @ORM\Column(name="website", type="string", length=255, nullable=true)
*/
private $website;
/**
* @var string
*
* @ORM\Column(name="phone", type="string", length=255, nullable=true)
*/
private $phone;
/**
* @var integer
*
* @ORM\Column(name="nbcourt", type="integer", nullable=true)
*/
private $nbCourt;
/**
* @var string
*
* @ORM\Column(name="contact_name", type="string", length=255, nullable=true)
*/
private $contactName;
/**
* @var string
*
* @ORM\Column(name="contact_phone", type="string", length=255, nullable=true)
*/
private $contactPhone;
/**
* @var string
*
* @ORM\Column(name="contact_email", type="string", length=255, nullable=true)
*/
private $contactEmail;
/**
* @var string
*
* @ORM\Column(name="description", type="text", length=255, nullable=true)
*/
private $description;
/**
* @var boolean
*
* @ORM\Column(name="clubhouse", type="boolean", options={"default": FALSE})
*/
private $clubhouse;
/**
* @var boolean
*
* @ORM\Column(name="restaurant", type="boolean", options={"default": FALSE})
*/
private $restaurant;
/**
* @var boolean
*
* @ORM\Column(name="reception_tam_player", type="boolean", options={"default": FALSE})
*/
private $receptionTamPlayer;
/**
* @var float
*
* @ORM\Column(name="price_session_tam", type="float", precision=10, scale=0, nullable=true)
*/
private $priceSessionTam;
/**
* @var integer
*
* @ORM\Column(name="nb_licensee", type="integer", nullable=true)
*/
private $nbLicensee;
/**
* @var integer
*
* @ORM\Column(name="nb_licensee_under_eighteen", type="integer", nullable=true)
*/
private $nbLicenseeUnderEighteen;
/**
* @var integer
*
* @ORM\Column(name="year_created", type="integer", nullable=true)
*/
private $yearCreated;
/**
* @var boolean
*
* @ORM\Column(name="distributor_gc", type="boolean", options={"default": FALSE})
*/
private $distributorGc;
/**
* @var boolean
*
* @ORM\Column(name="distributor_ch", type="boolean", options={"default": FALSE})
*/
private $distributorCh;
/**
* @var \DateTime
*
* @ORM\Column(name="date_ask_access", type="datetime", nullable=true)
*/
private $dateAskAccess;
/**
* @var \DateTime
*
* @ORM\Column(name="date_ask_access_granted", type="datetime", nullable=true)
*/
private $dateAskAccessGranted;
/**
* @var ArrayCollection
*
* @ORM\OneToMany(targetEntity="App\Entity\Club\ClubSurface", mappedBy="club", cascade={"persist", "remove"})
*/
private $clubSurfaces;
/**
* @var ArrayCollection $players
*
* @ORM\OneToMany(targetEntity="\App\Entity\Player\Player", mappedBy="club")
*/
private $players;
/**
* @var ArrayCollection
*
* @ORM\OneToMany(targetEntity="\App\Entity\Event\EventClub", mappedBy="club", cascade={"persist", "remove"})
*/
private $events;
/**
* @var ArrayCollection
*
* @ORM\OneToMany(targetEntity="\App\Entity\Tam\Tam", mappedBy="club", cascade={"persist", "remove"})
*/
private $tams;
public function __construct()
{
$this->clubSurfaces = new ArrayCollection();
$this->players = new ArrayCollection();
$this->events = new ArrayCollection();
$this->tams = new ArrayCollection();
$this->clubhouse = false;
$this->restaurant = false;
$this->receptionTamPlayer = false;
$this->distributorGc = false;
$this->distributorCh = false;
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set User
*
* @param \App\Entity\User $user
*
* @return Club
*/
public function setUser(\App\Entity\User $user)
{
$this->user = $user;
$user->setClub($this);
return $this;
}
/**
* Get user
*
* @return \App\Entity\User
*/
public function getUser()
{
return $this->user;
}
/**
* Set website
*
* @param string $website
*
* @return Club
*/
public function setWebsite($website)
{
$this->website = strtolower($website);
return $this;
}
/**
* Get website
*
* @return string
*/
public function getWebsite()
{
return $this->website;
}
/**
* Set phone
*
* @param string $phone
*
* @return Club
*/
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
/**
* Get phone
*
* @return string
*/
public function getPhone()
{
return $this->phone;
}
/**
* Set nbCourt
*
* @param integer $nbCourt
*
* @return Club
*/
public function setNbCourt($nbCourt)
{
$this->nbCourt = $nbCourt;
return $this;
}
/**
* Get nbCourt
*
* @return integer
*/
public function getNbCourt()
{
return $this->nbCourt;
}
/**
* Set contactName
*
* @param string $contactName
*
* @return Club
*/
public function setContactName($contactName)
{
$this->contactName = $contactName;
return $this;
}
/**
* Get contactName
*
* @return string
*/
public function getContactName()
{
return $this->contactName;
}
/**
* Set contactPhone
*
* @param string $contactPhone
*
* @return Club
*/
public function setContactPhone($contactPhone)
{
$this->contactPhone = $contactPhone;
return $this;
}
/**
* Get contactPhone
*
* @return string
*/
public function getContactPhone()
{
return $this->contactPhone;
}
/**
* Set contactEmail
*
* @param string $contactEmail
*
* @return Club
*/
public function setContactEmail($contactEmail)
{
$this->contactEmail = $contactEmail;
return $this;
}
/**
* Get contactEmail
*
* @return string
*/
public function getContactEmail()
{
return $this->contactEmail;
}
/**
* Set description
*
* @param string $description
*
* @return Club
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set clubhouse
*
* @param boolean $clubhouse
*
* @return Club
*/
public function setClubhouse($clubhouse)
{
$this->clubhouse = $clubhouse;
return $this;
}
/**
* Get clubhouse
*
* @return boolean
*/
public function getClubhouse()
{
return $this->clubhouse;
}
/**
* Have clubhouse
*
* @return boolean
*/
public function haveClubhouse()
{
return $this->clubhouse;
}
/**
* Set restaurant
*
* @param boolean $restaurant
*
* @return Club
*/
public function setRestaurant($restaurant)
{
$this->restaurant = $restaurant;
return $this;
}
/**
* Get restaurant
*
* @return boolean
*/
public function getRestaurant()
{
return $this->restaurant;
}
/**
* Have restaurant
*
* @return boolean
*/
public function haveRestaurant()
{
return $this->restaurant;
}
/**
* Set receptionTamPlayer
*
* @param boolean $receptionTamPlayer
*
* @return Club
*/
public function setReceptionTamPlayer($receptionTamPlayer)
{
$this->receptionTamPlayer = $receptionTamPlayer;
return $this;
}
/**
* Get receptionTamPlayer
*
* @return boolean
*/
public function getReceptionTamPlayer()
{
return $this->receptionTamPlayer;
}
/**
* Set priceSessionTam
*
* @param float $priceSessionTam
*
* @return Club
*/
public function setPriceSessionTam($priceSessionTam)
{
if($priceSessionTam == "")
$this->priceSessionTam = null;
else
$this->priceSessionTam = str_replace(",", ".", $priceSessionTam);
return $this;
}
/**
* Get priceSessionTam
*
* @return float
*/
public function getPriceSessionTam()
{
return $this->priceSessionTam;
}
/**
* Set nbLicensee
*
* @param integer $nbLicensee
*
* @return Club
*/
public function setNbLicensee($nbLicensee)
{
$this->nbLicensee = $nbLicensee;
return $this;
}
/**
* Get nbLicensee
*
* @return integer
*/
public function getNbLicensee()
{
return $this->nbLicensee;
}
/**
* Set nbLicenseeUnderEighteen
*
* @param integer $nbLicenseeUnderEighteen
*
* @return Club
*/
public function setNbLicenseeUnderEighteen($nbLicenseeUnderEighteen)
{
$this->nbLicenseeUnderEighteen = $nbLicenseeUnderEighteen;
return $this;
}
/**
* Get nbLicenseeUnderEighteen
*
* @return integer
*/
public function getNbLicenseeUnderEighteen()
{
return $this->nbLicenseeUnderEighteen;
}
/**
* Set yearCreated
*
* @param integer $yearCreated
*
* @return Club
*/
public function setYearCreated($yearCreated)
{
$this->yearCreated = $yearCreated;
return $this;
}
/**
* Get yearCreated
*
* @return integer
*/
public function getYearCreated()
{
return $this->yearCreated;
}
/**
* Set distributorGc
*
* @param boolean $distributorGc
*
* @return Club
*/
public function setDistributorGc($distributorGc)
{
$this->distributorGc = $distributorGc;
return $this;
}
/**
* Get distributorGc
*
* @return boolean
*/
public function getDistributorGc()
{
return $this->distributorGc;
}
/**
* Set distributorCh
*
* @param boolean $distributorCh
*
* @return Club
*/
public function setDistributorCh($distributorCh)
{
$this->distributorCh = $distributorCh;
return $this;
}
/**
* Get distributorCh
*
* @return boolean
*/
public function getDistributorCh()
{
return $this->distributorCh;
}
/**
* Set dateAskAccess
*
* @param \DateTime $dateAskAccess
*
* @return Club
*/
public function setDateAskAccess($dateAskAccess)
{
$this->dateAskAccess = $dateAskAccess;
return $this;
}
/**
* Get dateAskAccess
*
* @return \DateTime
*/
public function getDateAskAccess()
{
return $this->dateAskAccess;
}
/**
* Set dateAskAccessGranted
*
* @param \DateTime $dateAskAccessGranted
*
* @return Club
*/
public function setDateAskAccessGranted($dateAskAccessGranted)
{
$this->dateAskAccessGranted = $dateAskAccessGranted;
return $this;
}
/**
* Get dateAskAccessGranted
*
* @return \DateTime
*/
public function getDateAskAccessGranted()
{
return $this->dateAskAccessGranted;
}
/**
* Add clubSurface
*
* @param \App\Entity\Club\ClubSurface $clubSurface
*
* @return Club
*/
public function addClubSurface(\App\Entity\Club\ClubSurface $clubSurface)
{
$clubSurface->setClub($this);
$this->clubSurfaces[] = $clubSurface;
return $this;
}
/**
* Remove clubSurface
*
* @param \App\Entity\Club\ClubSurface $clubSurface
*/
public function removeClubSurface(\App\Entity\Club\ClubSurface $clubSurface)
{
$this->clubSurfaces->removeElement($clubSurface);
}
/**
* Get clubSurfaces
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getClubSurfaces()
{
return $this->clubSurfaces;
}
/**
* Add player
*
* @param \App\Entity\Player\Player $player
*
* @return Club
*/
public function addPlayer(\App\Entity\Player\Player $player)
{
$this->players[] = $player;
return $this;
}
/**
* Remove player
*
* @param \App\Entity\Player\Player $player
*/
public function removePlayer(\App\Entity\Player\Player $player)
{
$this->players->removeElement($player);
}
/**
* Get players
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPlayers()
{
return $this->players;
}
/**
* Add event
*
* @param \App\Entity\Event\EventClub $event
*
* @return Club
*/
public function addEvent(\App\Entity\Event\EventClub $event)
{
$this->events[] = $event;
return $this;
}
/**
* Remove event
*
* @param \App\Entity\Event\EventClub $event
*/
public function removeEvent(\App\Entity\Event\EventClub $event)
{
$this->events->removeElement($event);
}
/**
* Get events
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getEvents()
{
return $this->events;
}
/**
* Add tam
*
* @param \App\Entity\Tam\Tam $tam
*
* @return Club
*/
public function addTam(\App\Entity\Tam\Tam $tam)
{
$this->tams[] = $tam;
return $this;
}
/**
* Remove tam
*
* @param \App\Entity\Tam\Tam $tam
*/
public function removeTam(\App\Entity\Tam\Tam $tam)
{
$this->tams->removeElement($tam);
}
/**
* Get tams
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getTams()
{
return $this->tams;
}
/***********************
* OTHER FUNCTION
***********************/
public function updateFromJson($jsonObject){
if(isset($jsonObject->description)){
$this->setDescription($jsonObject->description);
}
if(isset($jsonObject->phone)){
$this->setPhone($jsonObject->phone);
}
if(isset($jsonObject->website)){
$this->setWebsite($jsonObject->website);
}
if(isset($jsonObject->contactName)){
$this->setContactName($jsonObject->contactName);
}
if(isset($jsonObject->contactEmail)){
$this->setContactEmail($jsonObject->contactEmail);
}
if(isset($jsonObject->contactPhone)){
$this->setContactPhone($jsonObject->contactPhone);
}
if(isset($jsonObject->nbLicensee)){
$this->setNbLicensee($jsonObject->nbLicensee);
}
if(isset($jsonObject->clubHouse)){
$this->setClubhouse($jsonObject->clubHouse);
}
if(isset($jsonObject->restaurant)){
$this->setRestaurant($jsonObject->restaurant);
}
if(isset($jsonObject->receptionTamPlayer)){
$this->setReceptionTamPlayer($jsonObject->receptionTamPlayer);
}
}
public function getArrayForJson(){
$array = array();
$array['id'] = $this->getId();
$array['website'] = $this->getWebsite();
$array['phone'] = $this->getPhone();
$array['nbCourt'] = $this->getNbCourt();
$array['contactName'] = $this->getContactName();
$array['contactPhone'] = $this->getContactPhone();
$array['contactEmail'] = $this->getContactEmail();
$array['description'] = $this->getDescription();
$array['clubHouse'] = $this->getClubhouse();
$array['restaurant'] = $this->getRestaurant();
$array['receptionTamPlayer'] = $this->getReceptionTamPlayer();
$array['priceSessionTam'] = $this->getPriceSessionTam();
$array['nbLicensee'] = $this->getNbLicensee();
$array['nbLicenseeUnderEighteen'] = $this->getNbLicenseeUnderEighteen();
$array['yearCreated'] = $this->getYearCreated();
foreach($this->getClubSurfaces() as $surface){
$array['surfaces'][] = $surface->getArrayForJson();
}
return $array;
}
}