<?php
/**
* @Author: tristan
* @Date: 2017-04-04 12:33:00
* @Last Modified by: tristan
* @Last Modified time: 2017-04-07 17:40:31
*/
namespace App\Entity;
use Cake\Chronos\Chronos;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\HobitRepository")
* @ORM\Table(name="lf_hobit")
* @ORM\HasLifecycleCallbacks()
*/
class Hobit
{
const MY_HOME = "MY_HOME";
const LEISURE = "LEISURE";
const NOW = "NOW";
const LAST = "LAST";
const HISTORY = "HISTORY";
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var datetime
* @ORM\Column(name="dateCreatedByServer", type="datetime", nullable=true)
*/
protected $dateCreated;
/**
* @var string
* @ORM\Column(name="name", type="string", length=255, nullable=false)
* @Assert\NotBlank(
* message="positonGps.name_required",
* payload={"code" = "name_required"},
* groups={"new"}
* )
*/
protected $name;
/**
* @var string
* @ORM\Column(name="group_name", type="string", length=255, nullable=true)
*/
protected $groupName;
/**
* @var string
* @ORM\Column(name="activity_type", type="string", nullable=true)
*/
protected $activityType;
/**
*/
protected $groupNameTranslate;
/**
* @var boolean
* @ORM\Column(name="group_verif", type="boolean", nullable=true)
*/
protected $groupVerif;
/**
* @var string
* @ORM\Column(name="address", type="string", length=255, nullable=false)
* @Assert\NotBlank(
* message="positonGps.address_required",
* payload={"code" = "address_required"},
* groups={"new"}
* )
*/
protected $address;
/**
* @var string
* @ORM\Column(name="street", type="string", length=255, nullable=true)
*/
protected $street;
/**
* @var string
* @ORM\Column(name="number_street", type="string", length=255, nullable=true)
*/
protected $numberStreet;
/**
* @var string
* @ORM\Column(name="city", type="string", length=255, nullable=true)
*/
protected $city;
/**
* @var string
* @ORM\Column(name="postal_code", type="string", length=255, nullable=true)
*/
protected $postalCode;
/**
* @var string
* @ORM\Column(name="country", type="string", length=255, nullable=true)
*/
protected $country;
/**
* @var string
* @ORM\Column(name="latitude", type="string", length=255, nullable=false)
* @Assert\NotBlank(
* message="positonGps.latitude_required",
* payload={"code" = "latitude_required"},
* groups={"new"}
* )
*/
protected $latitude;
/**
* @var string
* @ORM\Column(name="longitude", type="string", length=255, nullable=false)
* @Assert\NotBlank(
* message="positionGps.longitude_required",
* payload={"code" = "longitude_required"},
* groups={"new"}
* )
*/
protected $longitude;
/**
* @var string
* @ORM\Column(name="type", type="string", length=255, nullable=false)
* @Assert\NotBlank(
* message="hobit.type_required",
* payload={"code" = "type_required"},
* groups={"new"}
* )
*/
protected $type;
/**
* @var string
* @ORM\Column(name="location_type", type="string", length=255, nullable=false)
* @Assert\NotBlank(
* message="hobit.type_required",
* payload={"code" = "type_required"},
* groups={"new"}
* )
*/
protected $locationType;
/**
* @var string
* @ORM\Column(name="id_place", type="text", nullable=true)
* @Assert\NotBlank(
* message="hobit.type_required",
* payload={"code" = "type_required"},
* groups={"new"}
* )
*/
protected $idPlace;
/**
* @var string
* @ORM\Column(name="status", type="string", length=255, nullable=false)
* @Assert\NotBlank(
* message="hobit.status_required",
* payload={"code" = "status_required"},
* groups={"new"}
* )
*/
protected $status;
/**
* @var datetime
* @ORM\Column(name="dateStartHobit", type="datetime", nullable=true)
* @Assert\NotBlank(
* message="hobit.dateStartHobit_required",
* payload={"code" = "dateStartHobit_required"},
* groups={"new"}
* )
*/
protected $dateStartHobit;
/**
* @var datetime
* @ORM\Column(name="dateEndHobit", type="datetime", nullable=true)
* @Assert\NotBlank(
* message="hobit.dateEndHobit_required",
* payload={"code" = "dateEndHobit_required"},
* groups={"new"}
* )
*/
protected $dateEndHobit;
/**
* @var integer
* @ORM\Column(name="numberRequest", type="integer", nullable=true)
*/
protected $numberRequest;
/**
* @var integer
* @ORM\ManyToOne(targetEntity="App\Entity\Hobit", inversedBy="childrens")
* @ORM\JoinColumn(name="parent", referencedColumnName="id", nullable=true)
*/
protected $parent;
/**
* @var hobits[]
* @ORM\OneToMany(targetEntity="App\Entity\Hobit", mappedBy="parent")
*/
protected $childrens;
/**
* @var hobitDates[]
* @ORM\OneToMany(targetEntity="App\Entity\HobitDate", mappedBy="hobit")
*/
protected $hobitDates;
/**
* @var user
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="positionsGps")
*/
protected $user;
/**
* Constructor
*/
public function __construct()
{
$this->childrens = new \Doctrine\Common\Collections\ArrayCollection();
$this->hobitDates = new ArrayCollection();
$this->dateCreated = Chronos::now("UTC");
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set latitude
*
* @param string $latitude
*
* @return Hobit
*/
public function setLatitude($latitude)
{
$this->latitude = $latitude;
return $this;
}
/**
* Get latitude
*
* @return string
*/
public function getLatitude()
{
return $this->latitude;
}
/**
* Set longitude
*
* @param string $longitude
*
* @return Hobit
*/
public function setLongitude($longitude)
{
$this->longitude = $longitude;
return $this;
}
/**
* Get longitude
*
* @return string
*/
public function getLongitude()
{
return $this->longitude;
}
/**
* Set type
*
* @param string $type
*
* @return Hobit
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* Set locationType
*
* @param string $locationType
*
* @return Hobit
*/
public function setLocationType($locationType)
{
$this->locationType = $locationType;
return $this;
}
/**
* Get locationType
*
* @return string
*/
public function getLocationType()
{
return $this->locationType;
}
/**
* Set idPlace
*
* @param string $idPlace
*
* @return Hobit
*/
public function setIdPlace($idPlace)
{
$this->idPlace = $idPlace;
return $this;
}
/**
* Get idPlace
*
* @return string
*/
public function getIdPlace()
{
return $this->idPlace;
}
/**
* Set name
*
* @param string $name
*
* @return Hobit
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set groupVerif
*
* @param string $group
*
* @return Hobit
*/
public function setGroupVerif($groupVerif)
{
$this->groupVerif = $groupVerif;
return $this;
}
/**
* Get groupVerif
*
* @return string
*/
public function getGroupVerif()
{
return $this->groupVerif;
}
/**
* Set address
*
* @param string $address
*
* @return Hobit
*/
public function setAddress($address)
{
$this->address = $address;
return $this;
}
/**
* Get address
*
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* Set dateStartHobit
*
* @param \DateTime $dateStartHobit
*
* @return Hobit
*/
public function setDateStartHobit($dateStartHobit)
{
$this->dateStartHobit = $dateStartHobit;
return $this;
}
/**
* Get dateStartHobit
*
* @return \DateTime
*/
public function getDateStartHobit()
{
return $this->dateStartHobit;
}
/**
* Get dateStartHobitTranslate
*
* @return \String
*/
public function getDateStartHobitTranslate()
{
$dateStartHobitTranslate = $this->dateStartHobit->format("d-m-Y H:i");
return $dateStartHobitTranslate;
}
/**
* Set dateEndHobit
*
* @param \DateTime $dateEndHobit
*
* @return Hobit
*/
public function setDateEndHobit($dateEndHobit)
{
$this->dateEndHobit = $dateEndHobit;
return $this;
}
/**
* Get dateEndHobit
*
* @return \DateTime
*/
public function getDateEndHobit()
{
return $this->dateEndHobit;
}
/**
* Get dateEndHobitTranslate
*
* @return \String
*/
public function getDateEndHobitTranslate()
{
$dateEndHobitTranslate = $this->dateEndHobit->format("d-m-Y H:i");
return $dateEndHobitTranslate;
}
/**
* Set numberRequest
*
* @param integer $numberRequest
*
* @return Hobit
*/
public function setNumberRequest($numberRequest)
{
$this->numberRequest = $numberRequest;
return $this;
}
/**
* Get numberRequest
*
* @return integer
*/
public function getNumberRequest()
{
return $this->numberRequest;
}
/**
* Set status
*
* @param string $status
*
* @return Hobit
*/
public function setStatus($status)
{
$this->status = $status;
return $this;
}
/**
* Get status
*
* @return string
*/
public function getStatus()
{
return $this->status;
}
/**
* Set parent.
*
* @param \HobitBundle\Entity\Hobit|null $parent
*
* @return Hobit
*/
public function setParent(\HobitBundle\Entity\Hobit $parent = null)
{
$this->parent = $parent;
return $this;
}
/**
* Get parent.
*
* @return \HobitBundle\Entity\Hobit|null
*/
public function getParent()
{
return $this->parent;
}
/**
* Add children.
*
* @param \HobitBundle\Entity\Hobit $children
*
* @return Hobit
*/
public function addChildren(\App\Entity\Hobit $children)
{
$this->childrens[] = $children;
return $this;
}
/**
* Remove children.
*
* @param \HobitBundle\Entity\Hobit $children
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeChildren(\App\Entity\Hobit $children)
{
return $this->childrens->removeElement($children);
}
/**
* Get childrens.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getChildrens()
{
return $this->childrens;
}
/**
* Add hobitDate.
*
* @param \HobitBundle\Entity\HobitDate $hobitDate
*
* @return Hobit
*/
public function addHobitDate(\App\Entity\HobitDate $hobitDate)
{
$this->hobitDates[] = $hobitDate;
return $this;
}
/**
* Remove hobitDate.
*
* @param \HobitBundle\Entity\HobitDate $hobitDate
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeHobitDate(\App\Entity\HobitDate $hobitDate)
{
return $this->hobitDates->removeElement($hobitDate);
}
/**
* Get hobitDates.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getHobitDates()
{
return $this->hobitDates;
}
/**
* Set street.
*
* @param string|null $street
*
* @return Hobit
*/
public function setStreet($street = null)
{
$this->street = $street;
return $this;
}
/**
* Get street.
*
* @return string|null
*/
public function getStreet()
{
return $this->street;
}
/**
* Set numberStreet.
*
* @param string|null $numberStreet
*
* @return Hobit
*/
public function setNumberStreet($numberStreet = null)
{
$this->numberStreet = $numberStreet;
return $this;
}
/**
* Get numberStreet.
*
* @return string|null
*/
public function getNumberStreet()
{
return $this->numberStreet;
}
/**
* Set city.
*
* @param string|null $city
*
* @return Hobit
*/
public function setCity($city = null)
{
$this->city = $city;
return $this;
}
/**
* Get city.
*
* @return string|null
*/
public function getCity()
{
return $this->city;
}
/**
* Set country.
*
* @param string|null $country
*
* @return Hobit
*/
public function setCountry($country = null)
{
$this->country = $country;
return $this;
}
/**
* Get country.
*
* @return string|null
*/
public function getCountry()
{
return $this->country;
}
/**
* Set groupName.
*
* @param string|null $groupName
*
* @return Hobit
*/
public function setGroupName($groupName = null)
{
$this->groupName = $groupName;
return $this;
}
/**
* Get groupName.
*
* @return string|null
*/
public function getGroupName()
{
return $this->groupName;
}
/**
* Get groupNameTranslate.
*
* @return string|null
*/
public function getGroupNameTranslate()
{
$groupNameTranslate = $this->groupName;
if($this->groupName == "home"){
$groupNameTranslate = "chez vous";
}
else if($this->groupName == "work"){
$groupNameTranslate = "travail";
}
return $groupNameTranslate;
}
/**
* Set postalCode.
*
* @param string|null $postalCode
*
* @return Hobit
*/
public function setPostalCode($postalCode = null)
{
$this->postalCode = $postalCode;
return $this;
}
/**
* Get postalCode.
*
* @return string|null
*/
public function getPostalCode()
{
return $this->postalCode;
}
public function isGroupVerif(): ?bool
{
return $this->groupVerif;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getDateCreated(): ?\DateTimeInterface
{
return $this->dateCreated;
}
public function setDateCreated(?\DateTimeInterface $dateCreated): self
{
$this->dateCreated = $dateCreated;
return $this;
}
public function getActivityType(): ?string
{
return $this->activityType;
}
public function setActivityType(?string $activityType): self
{
$this->activityType = $activityType;
return $this;
}
}