src/Daikin/BaseBundle/Entity/EmergencyStock/OrderItem.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Daikin\BaseBundle\Entity\EmergencyStock;
  3. use App\Daikin\BaseBundle\Entity\SparePartsPart;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * Class SparePartsOrderItem
  8.  * @package App\Daikin\BaseBundle\Entity
  9.  *
  10.  * @ORM\Entity(repositoryClass="App\Daikin\BaseBundle\Repository\OrderItemRepository")
  11.  * @ORM\Table(name="OrderItem")
  12.  */
  13. class OrderItem
  14. {
  15.     const PRETTY_ID_PREFIX 'DKNOI';
  16.     const STATUS_ORDERING 'ordering';
  17.     const STATUS_CREATED 'created';
  18.     const STATUS_CANCELED 'canceled';
  19.     const STATUS_ACCEPT 'accept';
  20.     const STATUS_PICKUP 'pickup';
  21.     const STATUS_DROPOFF 'dropoff';
  22.     const STATUS_UNDELIVERABLE 'undeliverable';
  23.     /**
  24.      * @var integer
  25.      *
  26.      * @ORM\Id()
  27.      * @ORM\Column(type="integer")
  28.      * @ORM\GeneratedValue(strategy="AUTO")
  29.      */
  30.     private $id;
  31.     /**
  32.      * @var string
  33.      *
  34.      * @ORM\Column(name="trackingNumber", type="string", nullable=true)
  35.      */
  36.     private $trackingNumber;
  37.     /**
  38.      * @var \DateTime
  39.      *
  40.      * @ORM\Column(name="desiredDeliveryDateTime", type="datetime", nullable=true)
  41.      */
  42.     private $desiredDeliveryDateTime;
  43.     /**
  44.      * @var Order
  45.      *
  46.      * @ORM\ManyToOne(targetEntity="App\Daikin\BaseBundle\Entity\EmergencyStock\Order", inversedBy="orderItems")
  47.      * @ORM\JoinColumn()
  48.      */
  49.     private $order;
  50.     /**
  51.      * @var string
  52.      *
  53.      * @ORM\Column(name="orderItemStatus", type="string")
  54.      */
  55.     private $orderItemStatus;
  56.     /**
  57.      * @var OrderItemStatusHistory[]
  58.      *
  59.      * @ORM\OneToMany(targetEntity="App\Daikin\BaseBundle\Entity\EmergencyStock\OrderItemStatusHistory", mappedBy="orderItem")
  60.      */
  61.     private $statusHistory;
  62.     /**
  63.      * @var OrderItemPart[]
  64.      *
  65.      * @ORM\OneToMany(targetEntity="App\Daikin\BaseBundle\Entity\EmergencyStock\OrderItemPart", mappedBy="orderItem")
  66.      */
  67.     private $parts;
  68.     /**
  69.      * @var Warehouse
  70.      *
  71.      * @ORM\ManyToOne(targetEntity="App\Daikin\BaseBundle\Entity\EmergencyStock\Warehouse")
  72.      * @ORM\JoinColumn()
  73.      */
  74.     private $warehouse;
  75.     /**
  76.      * duration in seconds
  77.      *
  78.      * @var integer
  79.      *
  80.      * @ORM\Column(type="integer", nullable=true)
  81.      */
  82.     private $duration;
  83.     /**
  84.      * @var integer
  85.      *
  86.      * @ORM\Column(name="durationInTraffic", type="integer", nullable=true)
  87.      */
  88.     private $durationInTraffic;
  89.     /**
  90.      * Distance in meter
  91.      *
  92.      * @var integer
  93.      *
  94.      * @ORM\Column(type="integer", nullable=true)
  95.      */
  96.     private $distance;
  97.     /**
  98.      * OrderItem constructor.
  99.      */
  100.     public function __construct()
  101.     {
  102.         $this->orderItemStatus self::STATUS_ORDERING;
  103.         $this->statusHistory = new ArrayCollection();
  104.         $this->parts = new ArrayCollection();
  105.     }
  106.     /**
  107.      * @return int
  108.      */
  109.     public function getId()
  110.     {
  111.         return $this->id;
  112.     }
  113.     /**
  114.      * @param int $id
  115.      */
  116.     public function setId($id)
  117.     {
  118.         $this->id $id;
  119.     }
  120.     /**
  121.      * @return string
  122.      */
  123.     public function getTrackingNumber()
  124.     {
  125.         return $this->trackingNumber;
  126.     }
  127.     /**
  128.      * @param string $trackingNumber
  129.      * @return OrderItem
  130.      */
  131.     public function setTrackingNumber($trackingNumber)
  132.     {
  133.         $this->trackingNumber $trackingNumber;
  134.         return $this;
  135.     }
  136.     /**
  137.      * @return \DateTime
  138.      */
  139.     public function getDesiredDeliveryDateTime()
  140.     {
  141.         return $this->desiredDeliveryDateTime;
  142.     }
  143.     /**
  144.      * @param \DateTime $desiredDeliveryDateTime
  145.      * @return OrderItem
  146.      */
  147.     public function setDesiredDeliveryDateTime($desiredDeliveryDateTime)
  148.     {
  149.         $this->desiredDeliveryDateTime $desiredDeliveryDateTime;
  150.         return $this;
  151.     }
  152.     /**
  153.      * @return Order
  154.      */
  155.     public function getOrder()
  156.     {
  157.         return $this->order;
  158.     }
  159.     /**
  160.      * @param Order $order
  161.      * @return OrderItem
  162.      */
  163.     public function setOrder($order)
  164.     {
  165.         $this->order $order;
  166.         return $this;
  167.     }
  168.     /**
  169.      * @return Warehouse
  170.      */
  171.     public function getWarehouse()
  172.     {
  173.         return $this->warehouse;
  174.     }
  175.     /**
  176.      * @param Warehouse $warehouse
  177.      * @return OrderItem
  178.      */
  179.     public function setWarehouse($warehouse)
  180.     {
  181.         $this->warehouse $warehouse;
  182.         return $this;
  183.     }
  184.     /**
  185.      * @return OrderItemPart[]|ArrayCollection
  186.      */
  187.     public function getParts()
  188.     {
  189.         return $this->parts;
  190.     }
  191.     /**
  192.      * @param SparePartsPart $parts
  193.      */
  194.     public function setParts($parts)
  195.     {
  196.         $this->parts $parts;
  197.     }
  198.     /**
  199.      * @return string
  200.      */
  201.     public function getOrderItemStatus()
  202.     {
  203.         return $this->orderItemStatus;
  204.     }
  205.     /**
  206.      * @param string $orderItemStatus
  207.      * @return OrderItem
  208.      */
  209.     public function setOrderItemStatus($orderItemStatus)
  210.     {
  211.         $this->orderItemStatus $orderItemStatus;
  212.         return $this;
  213.     }
  214.     /**
  215.      * @return int
  216.      */
  217.     public function getDuration()
  218.     {
  219.         return $this->duration;
  220.     }
  221.     /**
  222.      * @param int $duration
  223.      * @return OrderItem
  224.      */
  225.     public function setDuration($duration)
  226.     {
  227.         $this->duration $duration;
  228.         return $this;
  229.     }
  230.     /**
  231.      * @return int
  232.      */
  233.     public function getDurationInTraffic()
  234.     {
  235.         return $this->durationInTraffic;
  236.     }
  237.     /**
  238.      * @param int $durationInTraffic
  239.      * @return OrderItem
  240.      */
  241.     public function setDurationInTraffic($durationInTraffic)
  242.     {
  243.         $this->durationInTraffic $durationInTraffic;
  244.         return $this;
  245.     }
  246.     /**
  247.      * @return int
  248.      */
  249.     public function getDistance()
  250.     {
  251.         return $this->distance;
  252.     }
  253.     /**
  254.      * @param int $distance
  255.      * @return OrderItem
  256.      */
  257.     public function setDistance($distance)
  258.     {
  259.         $this->distance $distance;
  260.         return $this;
  261.     }
  262.     /**
  263.      * @return OrderItemStatusHistory[]
  264.      */
  265.     public function getStatusHistory()
  266.     {
  267.         return $this->statusHistory;
  268.     }
  269.     /**
  270.      * @param OrderItemStatusHistory[] $statusHistory
  271.      * @return OrderItem
  272.      */
  273.     public function setStatusHistory($statusHistory)
  274.     {
  275.         $this->statusHistory $statusHistory;
  276.         return $this;
  277.     }
  278.     /**
  279.      * @return string
  280.      */
  281.     public function getPrettyId()
  282.     {
  283.         return self::PRETTY_ID_PREFIX str_pad($this->getId(), 80STR_PAD_LEFT);
  284.     }
  285.     /**
  286.      * @return string
  287.      */
  288.     public function getShippingPrettyIdHash()
  289.     {
  290.         return md5($this->getTrackingNumber(). $this->getPrettyId());
  291.     }
  292. }