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.     /**
  136.      * @return array<Offer>
  137.      */
  138.     public function getActiveOffers(): array
  139.     {
  140.         return array_filter($this->offers->getValues(), static fn (Offer $offer): bool => $offer->isVisible());
  141.     }
  142.     public function getSales() {
  143.         return $this->sales;
  144.     }
  145.     public function getManager() {
  146.         return $this->manager;
  147.     }
  148.     public function setManager(User $manager) {
  149.         $this->manager $manager;
  150.     }
  151.     public function getStatus() {
  152.         return $this->status;
  153.     }
  154.     public function setStatus($status) {
  155.         $this->status $status;
  156.     }
  157.     public function getMapLogo(): ?DirectorMapLogo
  158.     {
  159.         return $this->mapLogo->count() > $this->mapLogo->first() : null;
  160.     }
  161.     public function setMapLogo(DirectorMapLogo $mapLogo): void
  162.     {
  163.         $mapLogo->setDirector($this);
  164.         $this->mapLogo = new ArrayCollection([$mapLogo]);
  165.     }
  166.     public function getOnlinePaymentLogo(): ?DirectorOnlinePaymentLogoMedia
  167.     {
  168.         return $this->onlinePaymentLogo->count() > $this->onlinePaymentLogo->first() : null;
  169.     }
  170.     public function setOnlinePaymentLogo(DirectorOnlinePaymentLogoMedia $onlinePaymentLogo): void
  171.     {
  172.         $onlinePaymentLogo->setDirector($this);
  173.         $this->onlinePaymentLogo = new ArrayCollection([$onlinePaymentLogo]);
  174.     }
  175.     public function getEntityIDList() {
  176.         $entityIDList = [];
  177.         foreach ($this->offers as $offer) {
  178.             $entityIDList[] = $offer->getID();
  179.         }
  180.         foreach ($this->sales as $sale) {
  181.             $entityIDList[] = $sale->getID();
  182.         }
  183.         return $entityIDList;
  184.     }
  185.     public function hasOffer($offerID) {
  186.         foreach ($this->offers as $offer) {
  187.              if ($offer->getID() == $offerID) {
  188.                  return true;
  189.              };
  190.         }
  191.         return false;
  192.     }
  193.     public function isPunished() {
  194.         return $this->punished;
  195.     }
  196.     public function setPunished($punished) {
  197.         $this->punished $punished;
  198.     }
  199.     public function getLastCodeNumber() {
  200.         return $this->lastCodeNumber;
  201.     }
  202.     public function setLastCodeNumber($lastCodeNumber) {
  203.         $this->lastCodeNumber $lastCodeNumber;
  204.     }
  205.     public function getAbout() {
  206.         return $this->about;
  207.     }
  208.     public function setAbout($about) {
  209.         $this->about $about;
  210.     }
  211.     /** @return \DateTime */
  212.     public function getCreatedOn() {
  213.         return $this->createdOn;
  214.     }
  215.     public function setCreatedOn($createdOn) {
  216.         $this->createdOn $createdOn;
  217.     }
  218.     /** @return \DateTime */
  219.     public function getModifiedOn() {
  220.         return $this->modifiedOn;
  221.     }
  222.     public function setModifiedOn($modifiedOn) {
  223.         $this->modifiedOn $modifiedOn;
  224.     }
  225.     public function getExtraEmails() {
  226.         return $this->extraEmails;
  227.     }
  228.     public function setExtraEmails($extraEmails) {
  229.         $this->extraEmails $extraEmails;
  230.     }
  231.     public function getPhoneNumber() {
  232.         return $this->phoneNumber;
  233.     }
  234.     public function setPhoneNumber($phoneNumber) {
  235.         $this->phoneNumber $phoneNumber;
  236.     }
  237.     public function getSite() {
  238.         return $this->site;
  239.     }
  240.     public function setSite($site) {
  241.         $this->site $site;
  242.     }
  243.     public function getTaxRegistrationDate() {
  244.         return $this->taxRegistrationDate;
  245.     }
  246.     public function setTaxRegistrationDate($taxRegistrationDate) {
  247.         $this->taxRegistrationDate $taxRegistrationDate;
  248.     }
  249.     public function getTradeRegistrationDate() {
  250.         return $this->tradeRegistrationDate;
  251.     }
  252.     public function setTradeRegistrationDate($tradeRegistrationDate) {
  253.         $this->tradeRegistrationDate $tradeRegistrationDate;
  254.     }
  255.     public function getRegistrationAuthority() {
  256.         return $this->registrationAuthority;
  257.     }
  258.     public function setRegistrationAuthority($registrationAuthority) {
  259.         $this->registrationAuthority $registrationAuthority;
  260.     }
  261.     public function getWorkingHours() {
  262.         return $this->workingHours;
  263.     }
  264.     public function setWorkingHours($workingHours) {
  265.         $this->workingHours $workingHours;
  266.     }
  267.     public function getLegalEmail() {
  268.         return $this->legalEmail;
  269.     }
  270.     public function setLegalEmail($legalEmail) {
  271.         $this->legalEmail $legalEmail;
  272.     }
  273.     public function getFooterInfo() {
  274.         return $this->footerInfo;
  275.     }
  276.     public function setFooterInfo($footerInfo) {
  277.         $this->footerInfo $footerInfo;
  278.     }
  279.     public function getInfoPages() {
  280.         return $this->infoPages;
  281.     }
  282.     public function addInfoPage(InfoPage $infoPage) {
  283.         if (!$this->infoPages->contains($infoPage)) {
  284.             $this->infoPages->add($infoPage);
  285.             $infoPage->setDirector($this);
  286.         }
  287.     }
  288.     /** @return ArrayCollection */
  289.     public function getNotes() {
  290.         return $this->notes;
  291.     }
  292.     public function addNote($note) {
  293.         if (!$this->notes->contains($note)) {
  294.             $this->notes->add($note);
  295.             $note->setSupplier($this);
  296.         }
  297.     }
  298.     public function getLegalAddress() {
  299.         return $this->legalAddress;
  300.     }
  301.     public function setLegalAddress($legalAddress) {
  302.         $this->legalAddress $legalAddress;
  303.     }
  304.     public function getAccountNumber() {
  305.         return $this->accountNumber;
  306.     }
  307.     public function setAccountNumber($accountNumber) {
  308.         $this->accountNumber $accountNumber;
  309.     }
  310.     /** @return Offer */
  311.     public function getPageOffer() {
  312.         return $this->pageOffer;
  313.     }
  314.     public function setPageOffer(Offer $pageOffer null) {
  315.         $this->pageOffer $pageOffer;
  316.     }
  317.     public function jsonSerialize(): array
  318.     {
  319.         return [
  320.             'ID' => $this->ID,
  321.             'email' => $this->email,
  322.             'legalEntity' => $this->legalEntity,
  323.             'receiveLetters' => $this->receiveLetters,
  324.             'about' => $this->about,
  325.         ];
  326.     }
  327.     public function getCompanyLink() {
  328.         return $this->companyLink;
  329.     }
  330.     public function setCompanyLink($companyLink) {
  331.         $this->companyLink $companyLink;
  332.     }
  333. }