src/Entity/Order.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Classes\Hasher;
  4. use App\Entity\Type\OrderStatusType;
  5. use DateTime;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use JMS\Serializer\Annotation\ExclusionPolicy;
  10. use JMS\Serializer\Annotation\Expose;
  11. use JMS\Serializer\Annotation\MaxDepth;
  12. use Symfony\Component\Validator\Constraints as Assert;
  13. /**
  14.  * Class Order
  15.  *
  16.  * @ORM\Entity(repositoryClass="App\Repository\OrderRepository")
  17.  * @ORM\Table(name="malys_order")
  18.  * @ORM\HasLifecycleCallbacks()
  19.  * @package App\Entity
  20.  * @ExclusionPolicy("all")
  21.  */
  22. class Order
  23. {
  24.     public const CANCEL_STATUS 'cancel';
  25.     public const CONFIRM_STATUS 'confirm';
  26.     public const MAX_UPDATE_ORDER 2;
  27.     /** ****************ORDER FIELDS******************* */
  28.     /**
  29.      * @var integer
  30.      *
  31.      * @ORM\Column(name="id", type="integer")
  32.      * @ORM\Id
  33.      * @ORM\GeneratedValue(strategy="AUTO")
  34.      * @Expose
  35.      */
  36.     protected $id;
  37.     /**
  38.      * @var string
  39.      *
  40.      * @ORM\Column(name="status", type="string", length=255, nullable=false)
  41.      * @Assert\NotBlank
  42.      */
  43.     protected $status OrderStatusType::ORDER_CONFIRM;
  44.     /**
  45.      * @var ArrayCollection
  46.      *
  47.      * @ORM\OneToMany(targetEntity="OrderStatusHistory", mappedBy="order", cascade={"remove"}, orphanRemoval=true)
  48.      */
  49.     protected $statusHistory;
  50.     /**
  51.      * @var float
  52.      *
  53.      * @ORM\Column(name="price_excluding_tax", type="float", nullable=false)
  54.      * @Assert\NotBlank
  55.      * @Expose
  56.      */
  57.     protected $priceExcludingTax;
  58.     /**
  59.      * @var float
  60.      *
  61.      * @ORM\Column(name="amount_excluding_tax_paid", type="float", nullable=true)
  62.      * @Assert\NotBlank
  63.      * @Expose
  64.      */
  65.     protected $amountExcludingTaxPaid;
  66.     /**
  67.      * @var string
  68.      *
  69.      * @ORM\Column(name="note", type="text", nullable=true)
  70.      */
  71.     protected $note;
  72.     /**
  73.      * @var ArrayCollection
  74.      *
  75.      * @ORM\OneToMany(targetEntity="OrderItem", mappedBy="order", cascade={"persist", "remove"})
  76.      * @Expose
  77.      * @MaxDepth(1)
  78.      *
  79.      */
  80.     protected $items;
  81.     /**
  82.      * @var DateTime
  83.      *
  84.      * @ORM\Column(name="confirmation_date", type="datetime", nullable=true)
  85.      */
  86.     protected $confirmationDate;
  87.     /**
  88.      * @Expose
  89.      */
  90.     protected $label;
  91.     /** ****************CUSTOMER FIELDS******************* */
  92.     /**
  93.      * @var Customer
  94.      *
  95.      * @ORM\ManyToOne(targetEntity="Customer")
  96.      * @ORM\JoinColumn(name="customer_id", referencedColumnName="id", nullable=true)
  97.      * @Expose
  98.      * @MaxDepth(1)
  99.      */
  100.     protected $customer;
  101.     /**
  102.      * @var string
  103.      *
  104.      * @ORM\Column(name="user_first_name", type="string", length=255, nullable=true)
  105.      */
  106.     protected $userFirstName;
  107.     /**
  108.      * @var string
  109.      *
  110.      * @ORM\Column(name="user_last_name", type="string", length=255, nullable=true)
  111.      */
  112.     protected $userLastName;
  113.     /**
  114.      * @var string
  115.      *
  116.      * @ORM\Column(name="user_email", type="string", length=255, nullable=true)
  117.      */
  118.     protected $userEmail;
  119.     /**
  120.      * @var string
  121.      *
  122.      * @ORM\Column(name="user_phone", type="string", length=255, nullable=true)
  123.      */
  124.     protected $userPhone;
  125.     /**
  126.      * @var string
  127.      *
  128.      * @ORM\Column(name="user_mobile", type="string", length=255, nullable=true)
  129.      */
  130.     protected $userMobile;
  131.     /**
  132.      * @var string
  133.      *
  134.      * @ORM\Column(name="customer_brand_name", type="string", length=255, nullable=true)
  135.      */
  136.     protected $customerBrandName;
  137.     /**
  138.      * @var string
  139.      *
  140.      * @ORM\Column(name="customer_company_name", type="string", length=255, nullable=true)
  141.      */
  142.     protected $customerCompanyName;
  143.     /**
  144.      * @var string
  145.      *
  146.      * @ORM\Column(name="customer_business_number", type="string", length=255, nullable=true)
  147.      */
  148.     protected $customerBusinessNumber;
  149.     /**
  150.      * @var string
  151.      *
  152.      * @ORM\Column(name="customer_address", type="string", nullable=true)
  153.      */
  154.     protected $customerAddress;
  155.     /**
  156.      * @var string
  157.      *
  158.      * @ORM\Column(name="customer_zip_code", type="string", nullable=true)
  159.      */
  160.     protected $customerZipCode;
  161.     /**
  162.      * @var string
  163.      *
  164.      * @ORM\Column(name="customer_city", type="string", nullable=true)
  165.      */
  166.     protected $customerCity;
  167.     /**
  168.      * @var string
  169.      *
  170.      * @ORM\Column(name="customer_country", type="string", nullable=true)
  171.      */
  172.     protected $customerCountry;
  173.     /**
  174.      * @var string
  175.      *
  176.      * @ORM\Column(name="customer_phone", type="string", nullable=true)
  177.      */
  178.     protected $customerPhone;
  179.     /**
  180.      * @var string
  181.      *
  182.      * @ORM\Column(name="customer_mobile", type="string", nullable=true)
  183.      */
  184.     protected $customerMobile;
  185.     /**
  186.      * @var string
  187.      *
  188.      * @ORM\Column(name="adherent_number", type="string", length=255, nullable=true)
  189.      */
  190.     protected $adherentNumber;
  191.     /**
  192.      * @var DateTime
  193.      *
  194.      * @ORM\Column(name="customer_delivery_time_start", type="datetime", nullable=true)
  195.      */
  196.     protected $customerDeliveryTimeStart;
  197.     /**
  198.      * @var DateTime
  199.      *
  200.      * @ORM\Column(name="customer_delivery_time_end", type="datetime", nullable=true)
  201.      */
  202.     protected $customerDeliveryTimeEnd;
  203.     /**
  204.      * @var string
  205.      *
  206.      * @ORM\Column(name="customer_delivery_comment", type="text", nullable=true)
  207.      */
  208.     protected $customerDeliveryComment;
  209.     /** ****************SUPPLIER FIELDS******************* */
  210.     /**
  211.      * @var Supplier
  212.      *
  213.      * @ORM\ManyToOne(targetEntity="Supplier")
  214.      * @ORM\JoinColumn(name="supplier_id", referencedColumnName="id", onDelete="SET NULL", nullable=true)
  215.      * @Expose
  216.      * @MaxDepth(1)
  217.      */
  218.     protected $supplier;
  219.     /**
  220.      * @var User
  221.      *
  222.      * @ORM\ManyToOne(targetEntity="User")
  223.      * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="SET NULL", nullable=true)
  224.      * @Expose
  225.      * @MaxDepth(1)
  226.      */
  227.     protected $user;
  228.     /**
  229.      * @var string
  230.      *
  231.      * @ORM\Column(name="supplier_company_name", type="string", length=255, nullable=false)
  232.      */
  233.     protected $supplierCompanyName;
  234.     /**
  235.      * @var string
  236.      *
  237.      * @ORM\Column(name="supplier_email", type="string", length=255, nullable=false)
  238.      */
  239.     protected $supplierEmail;
  240.     /**
  241.      * @var string
  242.      *
  243.      * @ORM\Column(name="supplier_address", type="string", nullable=true)
  244.      */
  245.     protected $supplierAddress;
  246.     /**
  247.      * @var string
  248.      *
  249.      * @ORM\Column(name="supplier_zip_code", type="string", nullable=true)
  250.      */
  251.     protected $supplierZipCode;
  252.     /**
  253.      * @var string
  254.      *
  255.      * @ORM\Column(name="supplier_city", type="string", nullable=true)
  256.      */
  257.     protected $supplierCity;
  258.     /**
  259.      * @var string
  260.      *
  261.      * @ORM\Column(name="supplier_country", type="string", nullable=true)
  262.      */
  263.     protected $supplierCountry;
  264.     /**
  265.      * @var float
  266.      *
  267.      * @ORM\Column(name="supplier_minimum_tax_excluded", type="float", nullable=true)
  268.      */
  269.     protected $supplierMinimumTaxExcluded;
  270.     /**
  271.      * @var boolean
  272.      *
  273.      * @ORM\Column(name="supplier_primeur", type="boolean", nullable=true)
  274.      */
  275.     protected $supplierPrimeur;
  276.     /**
  277.      * @var boolean
  278.      *
  279.      * @ORM\Column(name="supplier_partner", type="boolean", nullable=true)
  280.      */
  281.     protected $supplierPartner;
  282.     /**
  283.      * @var string
  284.      *
  285.      * @ORM\Column(name="supplier_website", type="string", nullable=true)
  286.      */
  287.     protected $supplierWebsite;
  288.     /**
  289.      * @var DeliveryModel
  290.      *
  291.      * @ORM\ManyToOne(targetEntity="DeliveryModel")
  292.      * @ORM\JoinColumn(name="delivery_model_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
  293.      */
  294.     protected $deliveryModel;
  295.     /**
  296.      * @var string
  297.      *
  298.      * @ORM\Column(name="delivery_label", type="string", length=255, nullable=true)
  299.      * @Assert\NotBlank
  300.      */
  301.     protected $deliveryLabel;
  302.     /**
  303.      * @var string
  304.      *
  305.      * @ORM\Column(name="delivery_area", type="string", length=255, nullable=true)
  306.      * @Assert\NotBlank
  307.      */
  308.     protected $deliveryArea;
  309.     /**
  310.      * @var integer
  311.      *
  312.      * @ORM\Column(name="delivery_time", type="integer", nullable=true)
  313.      * @Assert\NotBlank
  314.      */
  315.     protected $deliveryTime;
  316.     /**
  317.      * @var array
  318.      *
  319.      * @ORM\Column(name="delivery_days", type="array", nullable=true)
  320.      * @Assert\NotBlank
  321.      */
  322.     protected $deliveryDays;
  323.     /**
  324.      * @var integer
  325.      *
  326.      * @ORM\Column(name="delivery_deadline", type="integer", nullable=true)
  327.      * @Assert\NotBlank
  328.      */
  329.     protected $deliveryDeadline;
  330.     /**
  331.      * @var DateTime
  332.      *
  333.      * @ORM\Column(name="delivery_date", type="datetime", nullable=false)
  334.      * @Assert\NotBlank
  335.      * @Expose
  336.      */
  337.     protected $deliveryDate;
  338.     /**
  339.      * @var DateTime
  340.      *
  341.      * @ORM\Column(name="created_at", type="datetime", nullable=false)
  342.      * @Expose
  343.      */
  344.     protected $createdAt;
  345.     /**
  346.      * @var DateTime
  347.      *
  348.      * @ORM\Column(name="updated_at", type="datetime", nullable=true)
  349.      * @Expose
  350.      */
  351.     protected $updatedAt;
  352.     /**
  353.      * Order is word reserved in mysql
  354.      * @ORM\OneToOne(targetEntity="App\Entity\Order")
  355.      * @ORM\JoinColumn(name="previous_order", referencedColumnName="id", nullable=true)
  356.      */
  357.     protected $previousOrder;
  358.     /**
  359.      * @var boolean
  360.      * @ORM\Column(type="boolean", name="visible", nullable=false, options={"default": true})
  361.      * @Expose
  362.      */
  363.     protected $visible true;
  364.     /**
  365.      * @var integer
  366.      * @ORM\Column(name="level", type="integer", nullable=false, options={"default": 0})
  367.      */
  368.     protected $level 0;
  369.     /**
  370.      * @var string
  371.      * @ORM\Column(name="original_id", type="string", nullable=true)
  372.      */
  373.     protected $originalId;
  374.     /**
  375.      * @ORM\ManyToOne(targetEntity="App\Entity\User")
  376.      * @ORM\JoinColumn(name="saleperson_id", referencedColumnName="id", nullable=true)
  377.      * @Expose
  378.      */
  379.     protected $salePerson;
  380.     /**
  381.      * @var string
  382.      *
  383.      * @ORM\Column(name="hashed_id", type="string", nullable=false)
  384.      */
  385.     protected $hashedId;
  386.     public function __construct()
  387.     {
  388.         $this->items         = new ArrayCollection();
  389.         $this->statusHistory = new ArrayCollection();
  390.         $this->buildLabel();
  391.     }
  392.     /**
  393.      * @return int
  394.      */
  395.     public function getId()
  396.     {
  397.         return $this->id;
  398.     }
  399.     /**
  400.      * @param int $id
  401.      */
  402.     public function setId($id)
  403.     {
  404.         $this->id $id;
  405.     }
  406.     /**
  407.      * @return string
  408.      */
  409.     public function getStatus()
  410.     {
  411.         return $this->status;
  412.     }
  413.     /**
  414.      * @param string $status
  415.      */
  416.     public function setStatus($status)
  417.     {
  418.         $this->status $status;
  419.     }
  420.     /**
  421.      * @return ArrayCollection
  422.      */
  423.     public function getStatusHistory()
  424.     {
  425.         return $this->statusHistory;
  426.     }
  427.     /**
  428.      * @param ArrayCollection $statusHistory
  429.      */
  430.     public function setStatusHistory($statusHistory)
  431.     {
  432.         $this->statusHistory $statusHistory;
  433.     }
  434.     /**
  435.      * @return float
  436.      */
  437.     public function getPriceExcludingTax()
  438.     {
  439.         return $this->priceExcludingTax;
  440.     }
  441.     /**
  442.      * @param float $priceExcludingTax
  443.      */
  444.     public function setPriceExcludingTax($priceExcludingTax)
  445.     {
  446.         $this->priceExcludingTax $priceExcludingTax;
  447.     }
  448.     /**
  449.      * @return float
  450.      */
  451.     public function getAmountExcludingTaxPaid()
  452.     {
  453.         return $this->amountExcludingTaxPaid;
  454.     }
  455.     /**
  456.      * @param float $amountExcludingTaxPaid
  457.      */
  458.     public function setAmountExcludingTaxPaid($amountExcludingTaxPaid)
  459.     {
  460.         $this->amountExcludingTaxPaid $amountExcludingTaxPaid;
  461.     }
  462.     /**
  463.      * @return string
  464.      */
  465.     public function getNote()
  466.     {
  467.         return $this->note;
  468.     }
  469.     /**
  470.      * @param string $note
  471.      */
  472.     public function setNote($note)
  473.     {
  474.         $this->note $note;
  475.     }
  476.     /**
  477.      * @return ArrayCollection
  478.      */
  479.     public function getItems()
  480.     {
  481.         return $this->items;
  482.     }
  483.     /**
  484.      * @return ArrayCollection|Collection
  485.      */
  486.     public function getActiveItems()
  487.     {
  488.         return $this->items;
  489.         //        return $this->items->filter(function($entry) {
  490.         //            /** @var $entry OrderItem */
  491.         //            if($entry->getProduct() instanceof Product) {
  492.         //                if ($entry->getProduct()->isEnabled()) {
  493.         //                    return true;
  494.         //                }
  495.         //            }
  496.         //            return false;
  497.         //        });
  498.     }
  499.     /**
  500.      * @param ArrayCollection $items
  501.      */
  502.     public function setItems($items)
  503.     {
  504.         $this->items $items;
  505.     }
  506.     /**
  507.      * @param OrderItem $item
  508.      */
  509.     public function addItem($item)
  510.     {
  511.         $this->items->add($item);
  512.     }
  513.     /**
  514.      * @param OrderItem $item
  515.      */
  516.     public function removeItem($item)
  517.     {
  518.         if ($this->items->contains($item)) {
  519.             $this->items->removeElement($item);
  520.         }
  521.     }
  522.     /**
  523.      * @return DateTime
  524.      */
  525.     public function getConfirmationDate()
  526.     {
  527.         return $this->confirmationDate;
  528.     }
  529.     /**
  530.      * @param DateTime $confirmationDate
  531.      */
  532.     public function setConfirmationDate($confirmationDate)
  533.     {
  534.         $this->confirmationDate $confirmationDate;
  535.     }
  536.     /**
  537.      * @return string
  538.      */
  539.     public function getUserFirstName()
  540.     {
  541.         return $this->userFirstName;
  542.     }
  543.     /**
  544.      * @param string $userFirstName
  545.      */
  546.     public function setUserFirstName($userFirstName)
  547.     {
  548.         $this->userFirstName $userFirstName;
  549.     }
  550.     /**
  551.      * @return string
  552.      */
  553.     public function getUserLastName()
  554.     {
  555.         return $this->userLastName;
  556.     }
  557.     /**
  558.      * @param string $userLastName
  559.      */
  560.     public function setUserLastName($userLastName)
  561.     {
  562.         $this->userLastName $userLastName;
  563.     }
  564.     /**
  565.      * @return string
  566.      */
  567.     public function getUserEmail()
  568.     {
  569.         return $this->userEmail;
  570.     }
  571.     /**
  572.      * @param string $userEmail
  573.      */
  574.     public function setUserEmail($userEmail)
  575.     {
  576.         $this->userEmail $userEmail;
  577.     }
  578.     /**
  579.      * @return string
  580.      */
  581.     public function getUserPhone()
  582.     {
  583.         return $this->userPhone;
  584.     }
  585.     /**
  586.      * @param string $userPhone
  587.      */
  588.     public function setUserPhone($userPhone)
  589.     {
  590.         $this->userPhone $userPhone;
  591.     }
  592.     /**
  593.      * @return string
  594.      */
  595.     public function getUserMobile()
  596.     {
  597.         return $this->userMobile;
  598.     }
  599.     /**
  600.      * @param string $userMobile
  601.      */
  602.     public function setUserMobile($userMobile)
  603.     {
  604.         $this->userMobile $userMobile;
  605.     }
  606.     /**
  607.      * @return string
  608.      */
  609.     public function getCustomerBrandName()
  610.     {
  611.         return $this->customerBrandName;
  612.     }
  613.     /**
  614.      * @param string $customerBrandName
  615.      */
  616.     public function setCustomerBrandName($customerBrandName)
  617.     {
  618.         $this->customerBrandName $customerBrandName;
  619.     }
  620.     /**
  621.      * @return string
  622.      */
  623.     public function getCustomerCompanyName()
  624.     {
  625.         return $this->customerCompanyName;
  626.     }
  627.     /**
  628.      * @param string $customerCompanyName
  629.      */
  630.     public function setCustomerCompanyName($customerCompanyName)
  631.     {
  632.         $this->customerCompanyName $customerCompanyName;
  633.     }
  634.     /**
  635.      * @return string
  636.      */
  637.     public function getCustomerBusinessNumber()
  638.     {
  639.         return $this->customerBusinessNumber;
  640.     }
  641.     /**
  642.      * @param string $customerBusinessNumber
  643.      */
  644.     public function setCustomerBusinessNumber($customerBusinessNumber)
  645.     {
  646.         $this->customerBusinessNumber $customerBusinessNumber;
  647.     }
  648.     /**
  649.      * @return string
  650.      */
  651.     public function getCustomerAddress()
  652.     {
  653.         return $this->customerAddress;
  654.     }
  655.     /**
  656.      * @param string $customerAddress
  657.      */
  658.     public function setCustomerAddress($customerAddress)
  659.     {
  660.         $this->customerAddress $customerAddress;
  661.     }
  662.     /**
  663.      * @return string
  664.      */
  665.     public function getCustomerZipCode()
  666.     {
  667.         return $this->customerZipCode;
  668.     }
  669.     /**
  670.      * @param string $customerZipCode
  671.      */
  672.     public function setCustomerZipCode($customerZipCode)
  673.     {
  674.         $this->customerZipCode $customerZipCode;
  675.     }
  676.     /**
  677.      * @return string
  678.      */
  679.     public function getCustomerCity()
  680.     {
  681.         return $this->customerCity;
  682.     }
  683.     /**
  684.      * @param string $customerCity
  685.      */
  686.     public function setCustomerCity($customerCity)
  687.     {
  688.         $this->customerCity $customerCity;
  689.     }
  690.     /**
  691.      * @return string
  692.      */
  693.     public function getCustomerCountry()
  694.     {
  695.         return $this->customerCountry;
  696.     }
  697.     /**
  698.      * @param string $customerCountry
  699.      */
  700.     public function setCustomerCountry($customerCountry)
  701.     {
  702.         $this->customerCountry $customerCountry;
  703.     }
  704.     /**
  705.      * @return string
  706.      */
  707.     public function getCustomerPhone()
  708.     {
  709.         return $this->customerPhone;
  710.     }
  711.     /**
  712.      * @param string $customerPhone
  713.      */
  714.     public function setCustomerPhone($customerPhone)
  715.     {
  716.         $this->customerPhone $customerPhone;
  717.     }
  718.     /**
  719.      * @return string
  720.      */
  721.     public function getCustomerMobile()
  722.     {
  723.         return $this->customerMobile;
  724.     }
  725.     /**
  726.      * @param string $customerMobile
  727.      */
  728.     public function setCustomerMobile($customerMobile)
  729.     {
  730.         $this->customerMobile $customerMobile;
  731.     }
  732.     /**
  733.      * @return DateTime
  734.      */
  735.     public function getCustomerDeliveryTimeStart()
  736.     {
  737.         return $this->customerDeliveryTimeStart;
  738.     }
  739.     /**
  740.      * @param DateTime $customerDeliveryTimeStart
  741.      */
  742.     public function setCustomerDeliveryTimeStart($customerDeliveryTimeStart)
  743.     {
  744.         $this->customerDeliveryTimeStart $customerDeliveryTimeStart;
  745.     }
  746.     /**
  747.      * @return DateTime
  748.      */
  749.     public function getCustomerDeliveryTimeEnd()
  750.     {
  751.         return $this->customerDeliveryTimeEnd;
  752.     }
  753.     /**
  754.      * @param DateTime $customerDeliveryTimeEnd
  755.      */
  756.     public function setCustomerDeliveryTimeEnd($customerDeliveryTimeEnd)
  757.     {
  758.         $this->customerDeliveryTimeEnd $customerDeliveryTimeEnd;
  759.     }
  760.     /**
  761.      * @return string
  762.      */
  763.     public function getCustomerDeliveryComment()
  764.     {
  765.         return $this->customerDeliveryComment;
  766.     }
  767.     /**
  768.      * @param string $customerDeliveryComment
  769.      */
  770.     public function setCustomerDeliveryComment($customerDeliveryComment)
  771.     {
  772.         $this->customerDeliveryComment $customerDeliveryComment;
  773.     }
  774.     /**
  775.      * @return string
  776.      */
  777.     public function getAdherentNumber()
  778.     {
  779.         return $this->adherentNumber;
  780.     }
  781.     /**
  782.      * @param string $adherentNumber
  783.      */
  784.     public function setAdherentNumber($adherentNumber)
  785.     {
  786.         $this->adherentNumber $adherentNumber;
  787.     }
  788.     /**
  789.      * @return string
  790.      */
  791.     public function getSupplierCompanyName()
  792.     {
  793.         return $this->supplierCompanyName;
  794.     }
  795.     /**
  796.      * @param string $supplierCompanyName
  797.      */
  798.     public function setSupplierCompanyName($supplierCompanyName)
  799.     {
  800.         $this->supplierCompanyName $supplierCompanyName;
  801.     }
  802.     /**
  803.      * @return string
  804.      */
  805.     public function getSupplierEmail()
  806.     {
  807.         return $this->supplierEmail;
  808.     }
  809.     /**
  810.      * @param string $supplierEmail
  811.      */
  812.     public function setSupplierEmail($supplierEmail)
  813.     {
  814.         $this->supplierEmail $supplierEmail;
  815.     }
  816.     /**
  817.      * @return string
  818.      */
  819.     public function getSupplierAddress()
  820.     {
  821.         return $this->supplierAddress;
  822.     }
  823.     /**
  824.      * @param string $supplierAddress
  825.      */
  826.     public function setSupplierAddress($supplierAddress)
  827.     {
  828.         $this->supplierAddress $supplierAddress;
  829.     }
  830.     /**
  831.      * @return string
  832.      */
  833.     public function getSupplierZipCode()
  834.     {
  835.         return $this->supplierZipCode;
  836.     }
  837.     /**
  838.      * @param string $supplierZipCode
  839.      */
  840.     public function setSupplierZipCode($supplierZipCode)
  841.     {
  842.         $this->supplierZipCode $supplierZipCode;
  843.     }
  844.     /**
  845.      * @return string
  846.      */
  847.     public function getSupplierCity()
  848.     {
  849.         return $this->supplierCity;
  850.     }
  851.     /**
  852.      * @param string $supplierCity
  853.      */
  854.     public function setSupplierCity($supplierCity)
  855.     {
  856.         $this->supplierCity $supplierCity;
  857.     }
  858.     /**
  859.      * @return string
  860.      */
  861.     public function getSupplierCountry()
  862.     {
  863.         return $this->supplierCountry;
  864.     }
  865.     /**
  866.      * @param string $supplierCountry
  867.      */
  868.     public function setSupplierCountry($supplierCountry)
  869.     {
  870.         $this->supplierCountry $supplierCountry;
  871.     }
  872.     /**
  873.      * @return float
  874.      */
  875.     public function getSupplierMinimumTaxExcluded()
  876.     {
  877.         return $this->supplierMinimumTaxExcluded;
  878.     }
  879.     /**
  880.      * @param float $supplierMinimumTaxExcluded
  881.      */
  882.     public function setSupplierMinimumTaxExcluded($supplierMinimumTaxExcluded)
  883.     {
  884.         $this->supplierMinimumTaxExcluded $supplierMinimumTaxExcluded;
  885.     }
  886.     /**
  887.      * @return bool
  888.      */
  889.     public function isSupplierPrimeur()
  890.     {
  891.         return $this->supplierPrimeur;
  892.     }
  893.     /**
  894.      * @param bool $supplierPrimeur
  895.      */
  896.     public function setSupplierPrimeur($supplierPrimeur)
  897.     {
  898.         $this->supplierPrimeur $supplierPrimeur;
  899.     }
  900.     /**
  901.      * @return string
  902.      */
  903.     public function getSupplierWebsite()
  904.     {
  905.         return $this->supplierWebsite;
  906.     }
  907.     /**
  908.      * @param string $supplierWebsite
  909.      */
  910.     public function setSupplierWebsite($supplierWebsite)
  911.     {
  912.         $this->supplierWebsite $supplierWebsite;
  913.     }
  914.     /**
  915.      * @param DeliveryModel $deliveryModel
  916.      */
  917.     public function setDeliveryModel($deliveryModel)
  918.     {
  919.         $this->deliveryModel $deliveryModel;
  920.     }
  921.     /**
  922.      * @param User $user
  923.      */
  924.     public function setUser(User $user)
  925.     {
  926.         $this->user $user;
  927.     }
  928.     /**
  929.      * @return string
  930.      */
  931.     public function getDeliveryLabel()
  932.     {
  933.         return $this->deliveryLabel;
  934.     }
  935.     /**
  936.      * @param string $deliveryLabel
  937.      */
  938.     public function setDeliveryLabel($deliveryLabel)
  939.     {
  940.         $this->deliveryLabel $deliveryLabel;
  941.     }
  942.     /**
  943.      * @return string
  944.      */
  945.     public function getDeliveryArea()
  946.     {
  947.         return $this->deliveryArea;
  948.     }
  949.     /**
  950.      * @param string $deliveryArea
  951.      */
  952.     public function setDeliveryArea($deliveryArea)
  953.     {
  954.         $this->deliveryArea $deliveryArea;
  955.     }
  956.     /**
  957.      * @return integer
  958.      */
  959.     public function getDeliveryTime()
  960.     {
  961.         return $this->deliveryTime;
  962.     }
  963.     /**
  964.      * @param integer $deliveryTime
  965.      */
  966.     public function setDeliveryTime($deliveryTime)
  967.     {
  968.         $this->deliveryTime $deliveryTime;
  969.     }
  970.     /**
  971.      * @return array
  972.      */
  973.     public function getDeliveryDays()
  974.     {
  975.         return $this->deliveryDays;
  976.     }
  977.     /**
  978.      * @param array $deliveryDays
  979.      */
  980.     public function setDeliveryDays($deliveryDays)
  981.     {
  982.         $this->deliveryDays $deliveryDays;
  983.     }
  984.     /**
  985.      * @return integer
  986.      */
  987.     public function getDeliveryDeadline()
  988.     {
  989.         return $this->deliveryDeadline;
  990.     }
  991.     /**
  992.      * @param integer $deliveryDeadline
  993.      */
  994.     public function setDeliveryDeadline($deliveryDeadline)
  995.     {
  996.         $this->deliveryDeadline $deliveryDeadline;
  997.     }
  998.     /**
  999.      * @return DateTime
  1000.      */
  1001.     public function getDeliveryDate()
  1002.     {
  1003.         return $this->deliveryDate;
  1004.     }
  1005.     /**
  1006.      * @param DateTime $deliveryDate
  1007.      */
  1008.     public function setDeliveryDate($deliveryDate)
  1009.     {
  1010.         $this->deliveryDate $deliveryDate;
  1011.     }
  1012.     /**
  1013.      * @param Customer $customer
  1014.      */
  1015.     public function setCustomer($customer)
  1016.     {
  1017.         $this->customer $customer;
  1018.     }
  1019.     /**
  1020.      * @param Supplier $supplier
  1021.      */
  1022.     public function setSupplier($supplier)
  1023.     {
  1024.         $this->supplier $supplier;
  1025.     }
  1026.     /**
  1027.      * @return Customer
  1028.      */
  1029.     public function getCustomer()
  1030.     {
  1031.         return $this->customer;
  1032.     }
  1033.     /**
  1034.      * @return Supplier
  1035.      */
  1036.     public function getSupplier()
  1037.     {
  1038.         return $this->supplier;
  1039.     }
  1040.     /**
  1041.      * @return DeliveryModel
  1042.      */
  1043.     public function getDeliveryModel()
  1044.     {
  1045.         return $this->deliveryModel;
  1046.     }
  1047.     public function getUser()
  1048.     {
  1049.         return $this->user;
  1050.     }
  1051.     /**
  1052.      * @return DateTime
  1053.      */
  1054.     public function getCreatedAt()
  1055.     {
  1056.         return $this->createdAt;
  1057.     }
  1058.     /**
  1059.      * @param $date
  1060.      */
  1061.     public function setCreatedAt($date null)
  1062.     {
  1063.         if ($date != null) {
  1064.             $this->createdAt $date;
  1065.         } else {
  1066.             $this->createdAt = new DateTime();
  1067.         }
  1068.         $this->updatedAt = new DateTime();
  1069.     }
  1070.     /**
  1071.      * @return DateTime
  1072.      */
  1073.     public function getUpdatedAt()
  1074.     {
  1075.         return $this->updatedAt;
  1076.     }
  1077.     /**
  1078.      * Set updatedAt
  1079.      *
  1080.      * @return Order
  1081.      * @ORM\PreUpdate
  1082.      */
  1083.     public function setUpdatedAt()
  1084.     {
  1085.         $this->updatedAt = new DateTime();
  1086.         return $this;
  1087.     }
  1088.     /**
  1089.      * @return mixed
  1090.      */
  1091.     public function getPreviousOrder()
  1092.     {
  1093.         return $this->previousOrder;
  1094.     }
  1095.     /**
  1096.      * @param mixed $previousOrder
  1097.      */
  1098.     public function setPreviousOrder($previousOrder)
  1099.     {
  1100.         $this->previousOrder $previousOrder;
  1101.     }
  1102.     /**
  1103.      * @return bool
  1104.      */
  1105.     public function isVisible()
  1106.     {
  1107.         return $this->visible;
  1108.     }
  1109.     /**
  1110.      * @param bool $visible
  1111.      */
  1112.     public function setVisible($visible)
  1113.     {
  1114.         $this->visible $visible;
  1115.     }
  1116.     /**
  1117.      * @return int
  1118.      */
  1119.     public function getLevel()
  1120.     {
  1121.         return $this->level;
  1122.     }
  1123.     /**
  1124.      * @param int $level
  1125.      */
  1126.     public function setLevel($level)
  1127.     {
  1128.         $this->level $level;
  1129.     }
  1130.     /**
  1131.      * @return string
  1132.      */
  1133.     public function getOriginalId()
  1134.     {
  1135.         return ($this->originalId 0) ? $this->originalId $this->id;
  1136.     }
  1137.     /**
  1138.      * @param string $originalId
  1139.      */
  1140.     public function setOriginalId($originalId)
  1141.     {
  1142.         $this->originalId $originalId;
  1143.     }
  1144.     /**
  1145.      * @return bool
  1146.      */
  1147.     public function canBeUpdated()
  1148.     {
  1149.         return ($this->level self::MAX_UPDATE_ORDER && $this->visible && $this->status != OrderStatusType::ORDER_CANCEL);
  1150.     }
  1151.     /**
  1152.      * @return int|string
  1153.      */
  1154.     public function buildLabel()
  1155.     {
  1156.         $label null;
  1157.         if (! empty($this->getId())) {
  1158.             if ($this->level == 0) {
  1159.                 $label $this->getId();
  1160.             } else {
  1161.                 $label $this->originalId '/' $this->level;
  1162.             }
  1163.         }
  1164.         $this->label $label;
  1165.     }
  1166.     public function getLabel()
  1167.     {
  1168.         $this->buildLabel();
  1169.         return $this->label;
  1170.     }
  1171.     public function getDashLabel()
  1172.     {
  1173.         $label $this->getLabel();
  1174.         $label str_replace('/''-'$label);
  1175.         return $label;
  1176.     }
  1177.     /**
  1178.      * @return bool
  1179.      */
  1180.     public function isSupplierPartner()
  1181.     {
  1182.         return $this->supplierPartner;
  1183.     }
  1184.     /**
  1185.      * @param bool $supplierPartner
  1186.      */
  1187.     public function setSupplierPartner($supplierPartner)
  1188.     {
  1189.         $this->supplierPartner $supplierPartner;
  1190.     }
  1191.     /**
  1192.      * @return mixed
  1193.      */
  1194.     public function getSalePerson()
  1195.     {
  1196.         return $this->salePerson;
  1197.     }
  1198.     /**
  1199.      * @param mixed $salePerson
  1200.      */
  1201.     public function setSalePerson($salePerson)
  1202.     {
  1203.         $this->salePerson $salePerson;
  1204.     }
  1205.     /**
  1206.      * @return string
  1207.      */
  1208.     public function getHashedId()
  1209.     {
  1210.         return $this->hashedId;
  1211.     }
  1212.     /**
  1213.      * @ORM\PrePersist
  1214.      */
  1215.     public function installHashedId()
  1216.     {
  1217.         if (is_null($this->hashedId)) {
  1218.             $this->hashedId self::generateOrderHash();
  1219.         }
  1220.     }
  1221.     public static function generateOrderHash()
  1222.     {
  1223.         return Hasher::generateHash(self::class);
  1224.     }
  1225. }