src\Model\User\Company\Company.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Model\User\Company;
  3. use App\Model\User\User;
  4. use App\Repository\CompanyRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Gedmo\Timestampable\Traits\TimestampableEntity;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. /**
  11.  * @ORM\Entity(repositoryClass=CompanyRepository::class)
  12.  * @ORM\Table(name="company")
  13.  */
  14. class Company
  15. {
  16.     use TimestampableEntity;
  17.     const CTYPE_KKCG        "kkcg";
  18.     const CTYPE_SAZKA       "sazka";
  19.     const CTYPE_EXTERNAL    "external";
  20.     /**
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue
  23.      * @ORM\Column(type="integer")
  24.      * @Groups({"company"})
  25.      */
  26.     private $id;
  27.     /**
  28.      * @var string
  29.      * @ORM\Column(type="string", length=64)
  30.      * @Groups({"company"})
  31.      */
  32.     private $name;
  33.     /**
  34.      * @ORM\ManyToMany(targetEntity="App\Model\User\User", mappedBy="companies")
  35.      * @Groups({"companyUsers"})
  36.      */
  37.     private $users;
  38.     /**
  39.      * @var string
  40.      * @ORM\Column(type="string", length=128)
  41.      * @Groups({"company"})
  42.      */
  43.     private $imgLogo;
  44.     /**
  45.      * Company Type - string constant
  46.      * @var string|null
  47.      * @ORM\Column(type="string", length=16, nullable=true)
  48.      * @Groups({"company"})
  49.      */
  50.     private $ctype;
  51.     /** @var bool
  52.      * @ORM\Column(type="boolean", nullable=false)
  53.      * @Groups({"company"})
  54.     */
  55.     private $allowVisitations;
  56.     /**
  57.      * @ORM\Column(type="integer", name="time_limit", nullable="true")
  58.      */
  59.     private $timeLimit;
  60.     /**
  61.      * @ORM\Column(type="integer", name="reservation_cancel_allowance", nullable="true")
  62.      */
  63.     private $reservationCancelAllowance;
  64.     /**
  65.      * @ORM\Column(type="boolean", nullable=false)
  66.      * @var bool
  67.      */
  68.     private $customSettings;
  69.     public $authtype;
  70.     public function __construct()
  71.     {
  72.         $this->users = new ArrayCollection();
  73.         $this->imgLogo "";
  74.         $this->allowVisitations true;
  75.         $this->authtype null;
  76.         $this->customSettings false;
  77.     }
  78.     public function getId(): ?int
  79.     {
  80.         return $this->id;
  81.     }
  82.     public function getName(): string
  83.     {
  84.         return $this->name;
  85.     }
  86.     /**
  87.      * @param string $name
  88.      */
  89.     public function setName(string $name): self
  90.     {
  91.         $this->name $name;
  92.         return $this;
  93.     }
  94.     /**
  95.      * @return Collection|User[]
  96.      */
  97.     public function getUsers(): Collection
  98.     {
  99.         return $this->users;
  100.     }
  101.     public function addUser(User $user): self
  102.     {
  103.         if (!$this->users->contains($user)) {
  104.             $this->users[] = $user;
  105.             $user->addCompany($this);
  106.         }
  107.         return $this;
  108.     }
  109.     public function removeUser(User $user): self
  110.     {
  111.         if ($this->users->contains($user)) {
  112.             $this->users->removeElement($user);
  113.             $user->removeCompany($this);
  114.         }
  115.         return $this;
  116.     }
  117.     public function __toString(): string
  118.     {
  119.         if($this->id != null)
  120.             return strval($this->id);
  121.         else return "null";
  122.     }
  123.     public function getImgLogo(): string
  124.     {
  125.         return $this->imgLogo;
  126.     }
  127.     /**
  128.      * @param string $imgLogo
  129.      */
  130.     public function setImgLogo(string $imgLogo): self
  131.     {
  132.         $this->imgLogo $imgLogo;
  133.         return $this;
  134.     }
  135.     /**
  136.      * @return  string
  137.      */
  138.     public function getCtype()
  139.     {
  140.         return $this->ctype;
  141.     }
  142.     /**
  143.      * @param  string  $ctype
  144.      * @return  self
  145.      */
  146.     public function setCtype(?string $ctype): self
  147.     {
  148.         $this->ctype $ctype;
  149.         return $this;
  150.     }
  151.     public static function getCtypes()
  152.     {
  153.         return [
  154.             self::CTYPE_KKCG,
  155.             self::CTYPE_SAZKA,
  156.             self::CTYPE_EXTERNAL,
  157.         ];
  158.     }
  159.     /**
  160.      * Get the value of allowVisitations
  161.      * @return bool
  162.      */
  163.     public function getAllowVisitations()
  164.     {
  165.         return $this->allowVisitations;
  166.     }
  167.     /**
  168.      * Set the value of allowVisitations
  169.      * @return self
  170.      * @param bool $allowVisitations
  171.      */
  172.     public function setAllowVisitations($allowVisitations): self
  173.     {
  174.         $this->allowVisitations $allowVisitations;
  175.         return $this;
  176.     }
  177.     /**
  178.      * Get the value of timeLimit
  179.      *
  180.      * @return int
  181.      */
  182.     public function getTimeLimit()
  183.     {
  184.         return $this->timeLimit;
  185.     }
  186.     /**
  187.      * Set the value of timeLimit
  188.      *
  189.      * @param int $timeLimit
  190.      *
  191.      * @return self
  192.      */
  193.     public function setTimeLimit($timeLimit): self
  194.     {
  195.         $this->timeLimit $timeLimit;
  196.         return $this;
  197.     }
  198.     /**
  199.      * Get the value of reservationCancelAllowance
  200.      *
  201.      * @return int
  202.      */
  203.     public function getReservationCancelAllowance()
  204.     {
  205.         return $this->reservationCancelAllowance;
  206.     }
  207.     /**
  208.      * Set the value of reservationCancelAllowance
  209.      *
  210.      * @param int $reservationCancelAllowance
  211.      *
  212.      * @return self
  213.      */
  214.     public function setReservationCancelAllowance($reservationCancelAllowance): self
  215.     {
  216.         $this->reservationCancelAllowance $reservationCancelAllowance;
  217.         return $this;
  218.     }
  219.     public function getCustomSettings(): bool
  220.     {
  221.         return $this->customSettings;
  222.     }
  223.     public function setCustomSettings($customSettings): self
  224.     {
  225.         $this->customSettings $customSettings;
  226.         return $this;
  227.     }
  228. }