src/Entity/Director.php line 10

Open in your IDE?
  1. <?php
  2. namespace Slivki\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Slivki\Entity\Media\DirectorMapLogo;
  6. use Slivki\Entity\Media\DirectorOnlinePaymentLogoMedia;
  7. class Director extends Entity implements \JsonSerializable {
  8.     const LOGO_MEDIA_PATH "/public/znijki-media/initial/default/1009921/";
  9.     const STATUS_ACTIVE 0;
  10.     const STATUS_WAIT 1;
  11.     const STATUS_DECLINE 2;
  12.     const STATUS_LIST = ['Привлечен''Думает''Отказ'];
  13.     const MARSEL_DIRECTOR_ID 2;
  14.     const SHAH_DIRECTOR_ID 15073;
  15.     const OBLAKA_DIRECTOR_ID 3771;
  16.     const WHITE_LOTUS_DIRECTOR_ID 3771;
  17.     const DIRECTORS_WITH_BEPAID = [
  18.         self::MARSEL_DIRECTOR_ID,
  19.         self::SHAH_DIRECTOR_ID,
  20.         self::OBLAKA_DIRECTOR_ID,
  21.         self::WHITE_LOTUS_DIRECTOR_ID
  22.     ];
  23.     protected $domainObjectID;
  24.     protected $name;
  25.     protected $email;
  26.     protected $legalEntity;
  27.     protected $taxID;
  28.     protected $receiveLetters;
  29.     protected $offers;
  30.     protected $sales;
  31.     protected $manager;
  32.     protected $teaserLogoWidth;
  33.     protected $teaserLogoHeight;
  34.     protected $status;
  35.     protected ?Collection $mapLogo;
  36.     protected ?Collection $onlinePaymentLogo;
  37.     protected $punished;
  38.     protected $lastCodeNumber;
  39.     protected $about;
  40.     protected $createdOn;
  41.     protected $modifiedOn;
  42.     protected $extraEmails;
  43.     protected $phoneNumber;
  44.     protected $site;
  45.     protected $notes;
  46.     protected $legalAddress;
  47.     protected $accountNumber;
  48.     protected $pageOffer;
  49.     protected $taxRegistrationDate;
  50.     protected $tradeRegistrationDate;
  51.     protected $registrationAuthority;
  52.     protected $workingHours;
  53.     protected $legalEmail;
  54.     protected $footerInfo;
  55.     protected $infoPages;
  56.     protected $companyLink;
  57.     public function __construct() {
  58.         $this->offers = new ArrayCollection();
  59.         $this->sales = new ArrayCollection();
  60.         $this->createdOn = new \DateTime();
  61.         $this->modifiedOn = new \DateTime();
  62.         $this->notes = new ArrayCollection();
  63.         $this->infoPages = new ArrayCollection();
  64.         $this->mapLogo = new ArrayCollection();
  65.         $this->onlinePaymentLogo = new ArrayCollection();
  66.         $this->punished false;
  67.     }
  68.     public function getName() {
  69.         return $this->name;
  70.     }
  71.     public function setName($name) {
  72.         $this->name $name;
  73.     }
  74.     public function getDomainObjectID() {
  75.         return $this->domainObjectID;
  76.     }
  77.     public function setDomainObjectID($domainObjectID) {
  78.         $this->domainObjectID $domainObjectID;
  79.     }
  80.     public function getEmail() {
  81.         return $this->email;
  82.     }
  83.     public function setEmail($email) {
  84.         $this->email trim(mb_strtolower($email));
  85.     }
  86.     public function getLegalEntity() {
  87.         return $this->legalEntity;
  88.     }
  89.     public function setLegalEntity($legalEntity) {
  90.         $this->legalEntity $legalEntity;
  91.     }
  92.     public function getTaxID (){
  93.         return $this->taxID;
  94.     }
  95.     public function setTaxID($taxID) {
  96.         $this->taxID $taxID;
  97.     }
  98.     public function isReceiveLetters() {
  99.         return $this->receiveLetters;
  100.     }
  101.     public function setReceiveLetters($receiveLetters) {
  102.         $this->receiveLetters $receiveLetters;
  103.     }
  104.     public function getTeaserLogoWidth() {
  105.         return $this->teaserLogoWidth;
  106.     }
  107.     public function setTeaserLogoWidth($teaserLogoWidth) {
  108.         $this->teaserLogoWidth $teaserLogoWidth;
  109.     }
  110.     public function getTeaserLogoHeight() {
  111.         return $this->teaserLogoHeight;
  112.     }
  113.     public function setTeaserLogoHeight($teaserLogoHeight) {
  114.         $this->teaserLogoHeight $teaserLogoHeight;
  115.     }
  116.     public function addOffer(Offer $offer) {
  117.         if (!$this->offers->contains($offer)) {
  118.             $this->offers->add($offer);
  119.         }
  120.     }
  121.     public function removeOffer(Offer $offer) {
  122.         $this->offers->removeElement($offer);
  123.     }
  124.     public function removeSale(Sale $sale) {
  125.         $this->sales->removeElement($sale);
  126.     }
  127.     public function addSale(Sale $offer) {
  128.         if (!$this->sales->contains($offer)) {
  129.             $this->sales->add($offer);
  130.         }
  131.     }
  132.     public function getOffers() {
  133.         return $this->offers;
  134.     }
  135.     public function getSales() {
  136.         return $this->sales;
  137.     }
  138.     public function getManager() {
  139.         return $this->manager;
  140.     }
  141.     public function setManager(User $manager) {
  142.         $this->manager $manager;
  143.     }
  144.     public function getStatus() {
  145.         return $this->status;
  146.     }
  147.     public function setStatus($status) {
  148.         $this->status $status;
  149.     }
  150.     public function getMapLogo(): ?DirectorMapLogo
  151.     {
  152.         return $this->mapLogo->count() > $this->mapLogo->first() : null;
  153.     }
  154.     public function setMapLogo(DirectorMapLogo $mapLogo): void
  155.     {
  156.         $mapLogo->setDirector($this);
  157.         $this->mapLogo = new ArrayCollection([$mapLogo]);
  158.     }
  159.     public function getOnlinePaymentLogo(): ?DirectorOnlinePaymentLogoMedia
  160.     {
  161.         return $this->onlinePaymentLogo->count() > $this->onlinePaymentLogo->first() : null;
  162.     }
  163.     public function setOnlinePaymentLogo(DirectorOnlinePaymentLogoMedia $onlinePaymentLogo): void
  164.     {
  165.         $onlinePaymentLogo->setDirector($this);
  166.         $this->onlinePaymentLogo = new ArrayCollection([$onlinePaymentLogo]);
  167.     }
  168.     public function getEntityIDList() {
  169.         $entityIDList = [];
  170.         foreach ($this->offers as $offer) {
  171.             $entityIDList[] = $offer->getID();
  172.         }
  173.         foreach ($this->sales as $sale) {
  174.             $entityIDList[] = $sale->getID();
  175.         }
  176.         return $entityIDList;
  177.     }
  178.     public function hasOffer($offerID) {
  179.         foreach ($this->offers as $offer) {
  180.              if ($offer->getID() == $offerID) {
  181.                  return true;
  182.              };
  183.         }
  184.         return false;
  185.     }
  186.     public function isPunished() {
  187.         return $this->punished;
  188.     }
  189.     public function setPunished($punished) {
  190.         $this->punished $punished;
  191.     }
  192.     public function getLastCodeNumber() {
  193.         return $this->lastCodeNumber;
  194.     }
  195.     public function setLastCodeNumber($lastCodeNumber) {
  196.         $this->lastCodeNumber $lastCodeNumber;
  197.     }
  198.     public function getAbout() {
  199.         return $this->about;
  200.     }
  201.     public function setAbout($about) {
  202.         $this->about $about;
  203.     }
  204.     /** @return \DateTime */
  205.     public function getCreatedOn() {
  206.         return $this->createdOn;
  207.     }
  208.     public function setCreatedOn($createdOn) {
  209.         $this->createdOn $createdOn;
  210.     }
  211.     /** @return \DateTime */
  212.     public function getModifiedOn() {
  213.         return $this->modifiedOn;
  214.     }
  215.     public function setModifiedOn($modifiedOn) {
  216.         $this->modifiedOn $modifiedOn;
  217.     }
  218.     public function getExtraEmails() {
  219.         return $this->extraEmails;
  220.     }
  221.     public function setExtraEmails($extraEmails) {
  222.         $this->extraEmails $extraEmails;
  223.     }
  224.     public function getPhoneNumber() {
  225.         return $this->phoneNumber;
  226.     }
  227.     public function setPhoneNumber($phoneNumber) {
  228.         $this->phoneNumber $phoneNumber;
  229.     }
  230.     public function getSite() {
  231.         return $this->site;
  232.     }
  233.     public function setSite($site) {
  234.         $this->site $site;
  235.     }
  236.     public function getTaxRegistrationDate() {
  237.         return $this->taxRegistrationDate;
  238.     }
  239.     public function setTaxRegistrationDate($taxRegistrationDate) {
  240.         $this->taxRegistrationDate $taxRegistrationDate;
  241.     }
  242.     public function getTradeRegistrationDate() {
  243.         return $this->tradeRegistrationDate;
  244.     }
  245.     public function setTradeRegistrationDate($tradeRegistrationDate) {
  246.         $this->tradeRegistrationDate $tradeRegistrationDate;
  247.     }
  248.     public function getRegistrationAuthority() {
  249.         return $this->registrationAuthority;
  250.     }
  251.     public function setRegistrationAuthority($registrationAuthority) {
  252.         $this->registrationAuthority $registrationAuthority;
  253.     }
  254.     public function getWorkingHours() {
  255.         return $this->workingHours;
  256.     }
  257.     public function setWorkingHours($workingHours) {
  258.         $this->workingHours $workingHours;
  259.     }
  260.     public function getLegalEmail() {
  261.         return $this->legalEmail;
  262.     }
  263.     public function setLegalEmail($legalEmail) {
  264.         $this->legalEmail $legalEmail;
  265.     }
  266.     public function getFooterInfo() {
  267.         return $this->footerInfo;
  268.     }
  269.     public function setFooterInfo($footerInfo) {
  270.         $this->footerInfo $footerInfo;
  271.     }
  272.     public function getInfoPages() {
  273.         return $this->infoPages;
  274.     }
  275.     public function addInfoPage(InfoPage $infoPage) {
  276.         if (!$this->infoPages->contains($infoPage)) {
  277.             $this->infoPages->add($infoPage);
  278.             $infoPage->setDirector($this);
  279.         }
  280.     }
  281.     /** @return ArrayCollection */
  282.     public function getNotes() {
  283.         return $this->notes;
  284.     }
  285.     public function addNote($note) {
  286.         if (!$this->notes->contains($note)) {
  287.             $this->notes->add($note);
  288.             $note->setSupplier($this);
  289.         }
  290.     }
  291.     public function getLegalAddress() {
  292.         return $this->legalAddress;
  293.     }
  294.     public function setLegalAddress($legalAddress) {
  295.         $this->legalAddress $legalAddress;
  296.     }
  297.     public function getAccountNumber() {
  298.         return $this->accountNumber;
  299.     }
  300.     public function setAccountNumber($accountNumber) {
  301.         $this->accountNumber $accountNumber;
  302.     }
  303.     /** @return Offer */
  304.     public function getPageOffer() {
  305.         return $this->pageOffer;
  306.     }
  307.     public function setPageOffer(Offer $pageOffer null) {
  308.         $this->pageOffer $pageOffer;
  309.     }
  310.     public function jsonSerialize(): array
  311.     {
  312.         return [
  313.             'ID' => $this->ID,
  314.             'email' => $this->email,
  315.             'legalEntity' => $this->legalEntity,
  316.             'receiveLetters' => $this->receiveLetters,
  317.             'about' => $this->about,
  318.         ];
  319.     }
  320.     public function getCompanyLink() {
  321.         return $this->companyLink;
  322.     }
  323.     public function setCompanyLink($companyLink) {
  324.         $this->companyLink $companyLink;
  325.     }
  326. }