<?php
namespace App\Entity\Pro;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\Common\Collections\ArrayCollection;
/**
* Pro
*
* @ORM\Table(name="tam_pros")
* @ORM\Entity(repositoryClass="App\Repository\Pro\ProRepository")
* @ORM\HasLifecycleCallbacks
*/
class Pro
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @ORM\OneToOne(targetEntity="App\Entity\User", inversedBy="pro", cascade={"persist", "remove"})
* @ORM\JoinColumn(name="tam_user", referencedColumnName="id", onDelete="CASCADE", nullable=false)
*/
private $user;
/**
* @var \ProType
*
* @ORM\ManyToOne(targetEntity="\App\Entity\Pro\ProType", inversedBy="pros")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="type_pro", referencedColumnName="id", onDelete="SET NULL", nullable=true)
* })
*/
private $typePro;
/**
* @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 string
*
* @ORM\Column(name="description", type="text", length=255, nullable=true)
*/
private $description;
/**
* @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 \DateTime
*
* @ORM\Column(name="date_signin", type="datetime", nullable=true)
*/
private $dateSignin;
/**
* @var ArrayCollection $openingHours
*
* @ORM\OneToMany(targetEntity="\App\Entity\Pro\OpeningHour", mappedBy="pro", cascade={"persist", "remove"})
* @ORM\OrderBy({"day" = "ASC"})
*/
private $openingHours;
public function __construct()
{
$this->distributorGc = false;
$this->distributorCh = false;
$this->openingHours = new ArrayCollection();
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set User
*
* @param \App\Entity\User $user
*
* @return Pro
*/
public function setUser(\App\Entity\User $user)
{
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return \App\Entity\User
*/
public function getUser()
{
return $this->user;
}
/**
* Set typePro
*
* @param \App\Entity\Pro\proType $typePro
*
* @return Pro
*/
public function setTypePro(\App\Entity\Pro\ProType $typePro)
{
$this->typePro = $typePro;
return $this;
}
/**
* Get typePro
*
* @return \App\Entity\Pro\ProType
*/
public function getTypePro()
{
return $this->typePro;
}
/**
* Set website
*
* @param string $website
*
* @return Pro
*/
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 Pro
*/
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
/**
* Get phone
*
* @return string
*/
public function getPhone()
{
return $this->phone;
}
/**
* Set description
*
* @param string $description
*
* @return Pro
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set distributorGc
*
* @param boolean $distributorGc
*
* @return Pro
*/
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 Pro
*/
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 Pro
*/
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 Pro
*/
public function setDateAskAccessGranted($dateAskAccessGranted)
{
$this->dateAskAccessGranted = $dateAskAccessGranted;
return $this;
}
/**
* Get dateAskAccessGranted
*
* @return \DateTime
*/
public function getDateAskAccessGranted()
{
return $this->dateAskAccessGranted;
}
/**
* Set dateSignin
*
* @param \DateTime $dateSignin
*
* @return Pro
*/
public function setDateSignin($dateSignin)
{
$this->dateSignin = $dateSignin;
return $this;
}
/**
* Get dateSignin
*
* @return \DateTime
*/
public function getDateSignin()
{
return $this->dateSignin;
}
/**
* Add openingHour
*
* @param \App\Entity\Pro\OpeningHour $openingHour
*
* @return Pro
*/
public function addOpeningHour(\App\Entity\Pro\OpeningHour $openingHour)
{
$openingHour->setPro($this);
$this->openingHours[] = $openingHour;
return $this;
}
/**
* Remove openingHour
*
* @param \App\Entity\Pro\OpeningHour $openingHour
*/
public function removeOpeningHour(\App\Entity\Pro\OpeningHour $openingHour)
{
$this->openingHours->removeElement($openingHour);
}
/**
* Get openingHours
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getOpeningHours()
{
return $this->openingHours;
}
/***********************
* OTHER FUNCTION
***********************/
public function getArrayForJson(){
$array = array();
$array['id'] = $this->getId();
if($this->getTypePro())
$array['proType'] = $this->getTypePro()->getArrayForJson();
$array['website'] = $this->getWebsite();
$array['phone'] = $this->getPhone();
$array['description'] = $this->getDescription();
foreach($this->getOpeningHours() as $openingHour){
$array['openingHours'][] = $openingHour->getArrayForJson();
}
return $array;
}
}