src/Entity/Shop.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Entity\Configuration;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\ShopRepository")
  9.  * @ORM\Table(name="shop")
  10.  * @ORM\HasLifecycleCallbacks()
  11.  */
  12. class Shop
  13. {
  14.     use Traits\Id;
  15.     use Traits\Dates;
  16.     /**
  17.      * @var int
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     protected $insalesId;
  21.     /**
  22.      * @var string
  23.      * @ORM\Column(type="string")
  24.      */
  25.     protected $shop;
  26.     /**
  27.      * @var string
  28.      * @ORM\Column(type="string")
  29.      */
  30.     protected $password;
  31.     /**
  32.      * @var string
  33.      * @ORM\Column(type="string")
  34.      */
  35.     protected $passwordToken;
  36.     /**
  37.      * @var string
  38.      * @ORM\Column(type="string")
  39.      */
  40.     protected $widgetPassword;
  41.     /**
  42.      * @var integer
  43.      * @ORM\Column (type="integer")
  44.      */
  45.     protected $deliveryId;
  46.     /**
  47.      * @var integer
  48.      * @ORM\Column (type="integer")
  49.      */
  50.     protected $rateResultPropertyId;
  51.     /**
  52.      * @var boolean
  53.      * @ORM\Column(type="boolean")
  54.      */
  55.     protected $updateStatuses false;
  56.     /**
  57.      * @var boolean
  58.      * @ORM\Column(type="boolean")
  59.      */
  60.     protected $useCustomStatuses false;
  61.     /**
  62.      * @var Configuration\Connection
  63.      * @ORM\OneToOne(targetEntity="App\Entity\Configuration\Connection", mappedBy="shop", cascade={"all"}, orphanRemoval=true)
  64.      */
  65.     protected $connection;
  66.     /**
  67.      * @var Configuration\Calculation
  68.      * @ORM\OneToOne(targetEntity="App\Entity\Configuration\Calculation", mappedBy="shop", cascade={"all"}, orphanRemoval=true)
  69.      */
  70.     protected $calculation;
  71.     /**
  72.      * @var Configuration\Status[]
  73.      * @ORM\OneToMany(targetEntity="App\Entity\Configuration\Status", mappedBy="shop", cascade={"all"}, orphanRemoval=true)
  74.      */
  75.     protected $statuses;
  76.     /**
  77.      * @var Package[]
  78.      * @ORM\OneToMany(targetEntity="Package", mappedBy="shop", cascade={"all"}, orphanRemoval=true)
  79.      */
  80.     protected $catapultoOrders;
  81.     /**
  82.      * @var Order[]
  83.      * @ORM\OneToMany (targetEntity="App\Entity\Order", mappedBy="shop", cascade={"all"}, orphanRemoval=true)
  84.      */
  85.     protected $orders;
  86.     /** Флаг первичной синхронизации вариантов доставки после установки модуля
  87.      * @var bool
  88.      * @ORM\Column (type="boolean", options={"default": false})
  89.      */
  90.     protected $firstSync false;
  91.     /**
  92.      * @ORM\Column(type="boolean")
  93.      */
  94.     private $markPayed false;
  95.     /**
  96.      * @ORM\Column(type="string", length=100, nullable=true)
  97.      */
  98.     private $blockingStatus;
  99.     /**
  100.      * @return int
  101.      */
  102.     public function getInsalesId(): int
  103.     {
  104.         return (int)$this->insalesId;
  105.     }
  106.     /**
  107.      * @param int $insalesId
  108.      * @return self
  109.      */
  110.     public function setInsalesId(int $insalesId): self
  111.     {
  112.         $this->insalesId $insalesId;
  113.         return $this;
  114.     }
  115.     /**
  116.      * @return string
  117.      */
  118.     public function getShop(): string
  119.     {
  120.         return $this->shop;
  121.     }
  122.     /**
  123.      * @param string $shop
  124.      * @return self
  125.      */
  126.     public function setShop(string $shop): self
  127.     {
  128.         $this->shop $shop;
  129.         return $this;
  130.     }
  131.     /**
  132.      * @return string
  133.      */
  134.     public function getPassword(): ?string
  135.     {
  136.         return $this->password;
  137.     }
  138.     /**
  139.      * @param string $password
  140.      * @return self
  141.      */
  142.     public function setPassword(string $password): self
  143.     {
  144.         $this->password $password;
  145.         return $this;
  146.     }
  147.     /**
  148.      * @return string
  149.      */
  150.     public function getPasswordToken(): ?string
  151.     {
  152.         return $this->passwordToken;
  153.     }
  154.     /**
  155.      * @param string $passwordToken
  156.      *
  157.      * @return self
  158.      */
  159.     public function setPasswordToken(string $passwordToken): self
  160.     {
  161.         $this->passwordToken $passwordToken;
  162.         return $this;
  163.     }
  164.     /**
  165.      * @return string
  166.      */
  167.     public function getWidgetPassword(): string
  168.     {
  169.         return $this->widgetPassword;
  170.     }
  171.     /**
  172.      * @param string $widgetPassword
  173.      * @return self
  174.      */
  175.     public function setWidgetPassword(string $widgetPassword): self
  176.     {
  177.         $this->widgetPassword $widgetPassword;
  178.         return $this;
  179.     }
  180.     /**
  181.      * @return int
  182.      */
  183.     public function getDeliveryId(): int
  184.     {
  185.         return $this->deliveryId;
  186.     }
  187.     /**
  188.      * @param int $deliveryId
  189.      *
  190.      * @return Shop
  191.      */
  192.     public function setDeliveryId(int $deliveryId): self
  193.     {
  194.         $this->deliveryId $deliveryId;
  195.         return $this;
  196.     }
  197.     /**
  198.      * @return int
  199.      */
  200.     public function getRateResultPropertyId(): int
  201.     {
  202.         return $this->rateResultPropertyId;
  203.     }
  204.     /**
  205.      * @param int $rateResultPropertyId
  206.      *
  207.      * @return Shop
  208.      */
  209.     public function setRateResultPropertyId(int $rateResultPropertyId): Shop
  210.     {
  211.         $this->rateResultPropertyId $rateResultPropertyId;
  212.         return $this;
  213.     }
  214.     /**
  215.      * @return bool
  216.      */
  217.     public function isUpdateStatuses(): bool
  218.     {
  219.         return $this->updateStatuses;
  220.     }
  221.     /**
  222.      * @param bool $updateStatuses
  223.      * @return self
  224.      */
  225.     public function setUpdateStatuses(bool $updateStatuses): self
  226.     {
  227.         $this->updateStatuses $updateStatuses;
  228.         return $this;
  229.     }
  230.     /**
  231.      * @return bool
  232.      */
  233.     public function isUseCustomStatuses(): bool
  234.     {
  235.         return $this->useCustomStatuses;
  236.     }
  237.     /**
  238.      * @param bool $useCustomStatuses
  239.      * @return self
  240.      */
  241.     public function setUseCustomStatuses(bool $useCustomStatuses): self
  242.     {
  243.         $this->useCustomStatuses $useCustomStatuses;
  244.         return $this;
  245.     }
  246.     /**
  247.      * Генерация пароля для виджета
  248.      * @return self
  249.      */
  250.     public function createWidgetPassword(): self
  251.     {
  252.         $this->setWidgetPassword(
  253.             \md5(
  254.                 \implode(
  255.                     ':',
  256.                     [
  257.                         $this->getPassword(),
  258.                         $this->getPasswordToken(),
  259.                         \time()
  260.                     ]
  261.                 )
  262.             )
  263.         );
  264.         return $this;
  265.     }
  266.     /**
  267.      * @return self
  268.      * @throws \Exception
  269.      */
  270.     public function updateLastUpdateStatusDates()
  271.     {
  272.         $this->lastUpdateStatuses = new \DateTime();
  273.         return $this;
  274.     }
  275.     /**
  276.      * @return self
  277.      * @throws \Exception
  278.      */
  279.     public function updateLastUpdateTerminalsDates()
  280.     {
  281.         $this->lastUpdateTerminal = new \DateTime();
  282.         return $this;
  283.     }
  284.     /**
  285.      * @return \DateTime
  286.      */
  287.     public function getLastUpdateTerminal(): \DateTime
  288.     {
  289.         return $this->lastUpdateTerminal;
  290.     }
  291.     /**
  292.      * @return Configuration\Connection
  293.      */
  294.     public function getConnection(): ?Configuration\Connection
  295.     {
  296.         if (!$this->connection instanceof Configuration\Connection) {
  297.             $this->connection = new Configuration\Connection();
  298.             $this->connection->setShop($this);
  299.         }
  300.         return $this->connection;
  301.     }
  302.     /**
  303.      * @param Configuration\Connection $connection
  304.      */
  305.     public function setConnection(?Configuration\Connection $connection): void
  306.     {
  307.         $this->connection $connection;
  308.     }
  309.     /**
  310.      * @return Configuration\Calculation
  311.      */
  312.     public function getCalculation(): Configuration\Calculation
  313.     {
  314.         if (!$this->calculation instanceof Configuration\Calculation) {
  315.             $this->calculation = new Configuration\Calculation();
  316.             $this->calculation->setShop($this);
  317.         }
  318.         return $this->calculation;
  319.     }
  320.     /**
  321.      * @param Configuration\Calculation $calculation
  322.      */
  323.     public function setCalculation(Configuration\Calculation $calculation): void
  324.     {
  325.         $this->calculation $calculation;
  326.     }
  327.     /**
  328.      * @return \DateTime
  329.      */
  330.     public function getLastUpdateStatuses(): \DateTime
  331.     {
  332.         return $this->lastUpdateStatuses;
  333.     }
  334.     /**
  335.      * @param \DateTime $lastUpdateStatuses
  336.      */
  337.     public function setLastUpdateStatuses(\DateTime $lastUpdateStatuses): void
  338.     {
  339.         $this->lastUpdateStatuses $lastUpdateStatuses;
  340.     }
  341.     /**
  342.      * @return Configuration\Zone[]|null
  343.      */
  344.     public function getZonePrices(): ?array
  345.     {
  346.         return $this->zonePrices;
  347.     }
  348.     /**
  349.      * @param Configuration\Zone[]|null $zonePrices
  350.      */
  351.     public function setZonePrices(?array $zonePrices): void
  352.     {
  353.         $this->zonePrices $zonePrices;
  354.     }
  355.     /**
  356.      * @return bool
  357.      */
  358.     public function isUseZonePrice(): bool
  359.     {
  360.         return $this->useZonePrice;
  361.     }
  362.     /**
  363.      * @param bool $useZonePrice
  364.      */
  365.     public function setUseZonePrice(bool $useZonePrice): void
  366.     {
  367.         $this->useZonePrice $useZonePrice;
  368.     }
  369.     public function getZonePriceByZone($zone)
  370.     {
  371.     }
  372.     /**
  373.      * @return bool
  374.      */
  375.     public function getFirstSync(): bool
  376.     {
  377.         return $this->firstSync;
  378.     }
  379.     /**
  380.      * @param bool $flag
  381.      * @return  self
  382.      */
  383.     public function setFirstSync($flag): self
  384.     {
  385.         $this->firstSync $flag;
  386.         return $this;
  387.     }
  388.     public function getMarkPayed(): ?bool
  389.     {
  390.         return $this->markPayed;
  391.     }
  392.     public function setMarkPayed(bool $markPayed): self
  393.     {
  394.         $this->markPayed $markPayed;
  395.         return $this;
  396.     }
  397.     public function getBlockingStatus(): ?string
  398.     {
  399.         return $this->blockingStatus;
  400.     }
  401.     public function setBlockingStatus(?string $blockingStatus): self
  402.     {
  403.         $this->blockingStatus $blockingStatus;
  404.         return $this;
  405.     }
  406. }