<?php
namespace App\Model\User\Company;
use App\Model\User\User;
use App\Repository\CompanyRepository;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=CompanyRepository::class)
* @ORM\Table(name="company")
*/
class Company
{
use TimestampableEntity;
const CTYPE_KKCG = "kkcg";
const CTYPE_SAZKA = "sazka";
const CTYPE_EXTERNAL = "external";
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({"company"})
*/
private $id;
/**
* @var string
* @ORM\Column(type="string", length=64)
* @Groups({"company"})
*/
private $name;
/**
* @ORM\ManyToMany(targetEntity="App\Model\User\User", mappedBy="companies")
* @Groups({"companyUsers"})
*/
private $users;
/**
* @var string
* @ORM\Column(type="string", length=128)
* @Groups({"company"})
*/
private $imgLogo;
/**
* Company Type - string constant
* @var string|null
* @ORM\Column(type="string", length=16, nullable=true)
* @Groups({"company"})
*/
private $ctype;
/** @var bool
* @ORM\Column(type="boolean", nullable=false)
* @Groups({"company"})
*/
private $allowVisitations;
/**
* @ORM\Column(type="integer", name="time_limit", nullable="true")
*/
private $timeLimit;
/**
* @ORM\Column(type="integer", name="reservation_cancel_allowance", nullable="true")
*/
private $reservationCancelAllowance;
/**
* @ORM\Column(type="boolean", nullable=false)
* @var bool
*/
private $customSettings;
public $authtype;
public function __construct()
{
$this->users = new ArrayCollection();
$this->imgLogo = "";
$this->allowVisitations = true;
$this->authtype = null;
$this->customSettings = false;
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): string
{
return $this->name;
}
/**
* @param string $name
*/
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection|User[]
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
$user->addCompany($this);
}
return $this;
}
public function removeUser(User $user): self
{
if ($this->users->contains($user)) {
$this->users->removeElement($user);
$user->removeCompany($this);
}
return $this;
}
public function __toString(): string
{
if($this->id != null)
return strval($this->id);
else return "null";
}
public function getImgLogo(): string
{
return $this->imgLogo;
}
/**
* @param string $imgLogo
*/
public function setImgLogo(string $imgLogo): self
{
$this->imgLogo = $imgLogo;
return $this;
}
/**
* @return string
*/
public function getCtype()
{
return $this->ctype;
}
/**
* @param string $ctype
* @return self
*/
public function setCtype(?string $ctype): self
{
$this->ctype = $ctype;
return $this;
}
public static function getCtypes()
{
return [
self::CTYPE_KKCG,
self::CTYPE_SAZKA,
self::CTYPE_EXTERNAL,
];
}
/**
* Get the value of allowVisitations
* @return bool
*/
public function getAllowVisitations()
{
return $this->allowVisitations;
}
/**
* Set the value of allowVisitations
* @return self
* @param bool $allowVisitations
*/
public function setAllowVisitations($allowVisitations): self
{
$this->allowVisitations = $allowVisitations;
return $this;
}
/**
* Get the value of timeLimit
*
* @return int
*/
public function getTimeLimit()
{
return $this->timeLimit;
}
/**
* Set the value of timeLimit
*
* @param int $timeLimit
*
* @return self
*/
public function setTimeLimit($timeLimit): self
{
$this->timeLimit = $timeLimit;
return $this;
}
/**
* Get the value of reservationCancelAllowance
*
* @return int
*/
public function getReservationCancelAllowance()
{
return $this->reservationCancelAllowance;
}
/**
* Set the value of reservationCancelAllowance
*
* @param int $reservationCancelAllowance
*
* @return self
*/
public function setReservationCancelAllowance($reservationCancelAllowance): self
{
$this->reservationCancelAllowance = $reservationCancelAllowance;
return $this;
}
public function getCustomSettings(): bool
{
return $this->customSettings;
}
public function setCustomSettings($customSettings): self
{
$this->customSettings = $customSettings;
return $this;
}
}