src/AppBundle/MainBundle/Entity/Orders_Extended.php line 675

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: apple
  5.  * Date: 29/03/19
  6.  * Time: 3:08 PM
  7.  */
  8. namespace App\AppBundle\MainBundle\Entity;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. use JsonSerializable;
  13. /**
  14.  * AddOns
  15.  *
  16.  * @ORM\Entity
  17.  * @ORM\Table(name="orders_extended")
  18.  * @ORM\HasLifecycleCallbacks()
  19.  */
  20. class Orders_Extended implements JsonSerializable
  21. {
  22.     /**
  23.      * @ORM\Column(type="integer")
  24.      * @ORM\Id
  25.      * @ORM\GeneratedValue(strategy="AUTO")
  26.      */
  27.     private $id;
  28.     /**
  29.      * @var Orders_Pricing
  30.      * @ORM\OneToOne(targetEntity="Orders_Pricing")
  31.      * @ORM\JoinColumn(name="orders_pricing_id", referencedColumnName="id")
  32.      */
  33.     private $orders_pricing;
  34.     /**
  35.      * @ORM\Column(type="boolean", nullable=true, options={"default" : 0})
  36.      * @Assert\NotBlank()
  37.      */
  38.     private $is_completed;
  39.     /**
  40.      * @var \DateTime
  41.      * @ORM\Column(type="datetime", nullable=false)
  42.      * @Assert\NotBlank()
  43.      */
  44.     private $start_time;
  45.     /**
  46.      * @var \DateTime
  47.      * @ORM\Column(type="datetime", nullable=false)
  48.      * @Assert\NotBlank()
  49.      */
  50.     private $end_time;
  51.     /**
  52.      * @ORM\Column(type="boolean", nullable=true, options={"default" : 0})
  53.      * @Assert\NotBlank()
  54.      */
  55.     private $is_order_paid;
  56.     /**
  57.      * @ORM\Column(type="boolean", nullable=true, options={"default" : 0})
  58.      * @Assert\NotBlank()
  59.      */
  60.     private $is_email_sent;
  61.     /**
  62.      * @ORM\Column(type="boolean", nullable=true, options={"default" : 0})
  63.      * @Assert\NotBlank()
  64.      */
  65.     private $is_sms_sent;
  66.     /**
  67.      * @ORM\Column(type="boolean", nullable=true, options={"default" : 0})
  68.      * @Assert\NotBlank()
  69.      */
  70.     private $is_notification_sent;
  71.     /**
  72.      * @ORM\Column(type="boolean", nullable=true, options={"default" : 1})
  73.      * @Assert\NotBlank()
  74.      */
  75.     private $is_active;
  76.     /**
  77.      * @ORM\ManyToOne(targetEntity="WP_Payment")
  78.      * @ORM\JoinColumn(name="wp_payment_id", referencedColumnName="id", nullable=true)
  79.      */
  80.     private $wp_payment;
  81.     /**
  82.      * @ORM\Column(type="string", nullable=true)
  83.      */
  84.     private $payment_method_type;
  85.     /**
  86.      * @ORM\Column(type="string", nullable=true)
  87.      */
  88.     private $pay_stripe_customer_id;
  89.     /**
  90.      * @ORM\Column(type="string", nullable=true)
  91.      */
  92.     private $pay_stripe_card_id;
  93.     /**
  94.      * @ORM\Column(type="string", nullable=true)
  95.      */
  96.     private $pay_stripe_payment_intent_id;
  97.     /**
  98.      * @ORM\Column(type="string", nullable=true)
  99.      */
  100.     private $pay_stripe_payment_method_id;
  101.     /**
  102.      * @ORM\Column(type="string", nullable=true)
  103.      * @Assert\NotBlank()
  104.      */
  105.     private $pay_name;
  106.     /**
  107.      * @ORM\Column(type="string", nullable=true)
  108.      * @Assert\NotBlank()
  109.      */
  110.     private $pay_card_type;
  111.     /**
  112.      * @ORM\Column(type="string", nullable=true)
  113.      * @Assert\NotBlank()
  114.      */
  115.     private $pay_last_four;
  116.     /**
  117.      * @ORM\Column(type="string", nullable=true)
  118.      * @Assert\NotBlank()
  119.      */
  120.     private $pay_brand;
  121.     /**
  122.      * @ORM\Column(type="string", nullable=true)
  123.      * @Assert\NotBlank()
  124.      */
  125.     private $pay_expiry_month;
  126.     /**
  127.      * @ORM\Column(type="string", nullable=true)
  128.      * @Assert\NotBlank()
  129.      */
  130.     private $pay_expiry_year;
  131.     /**
  132.      * Many features have one product. This is the owning side.
  133.      * @ORM\ManyToOne(targetEntity="Orders", inversedBy="orders_extended")
  134.      * @ORM\JoinColumn(name="order_id", referencedColumnName="id")
  135.      */
  136.     private $orders;
  137.     /**
  138.      * @var \DateTime
  139.      * @ORM\Column(type="datetime", nullable=true)
  140.      * @Assert\NotBlank()
  141.      */
  142.     private $booking_cancelled_on;
  143.     /**
  144.      * @ORM\Column(type="integer", nullable=false, options={"default" : 0})
  145.      * @Assert\NotBlank()
  146.      */
  147.     private $booking_status;//2 - Completed, 3 - Cancelled by Spot Provider, 4 - Cancelled by Spot User, 5 - Cancelled From System, 6 Refunded, 7 - Non-Refunded
  148.     /**
  149.      * @ORM\Column(type="string", nullable=true)
  150.      * @Assert\NotBlank()
  151.      */
  152.     private $booking_cancelled_reason;
  153.     /**
  154.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  155.      * @Assert\NotBlank()
  156.      */
  157.     private $refund_amount;
  158.     /**
  159.      * @return mixed
  160.      */
  161.     public function getId()
  162.     {
  163.         return $this->id;
  164.     }
  165.     /**
  166.      * @return mixed
  167.      */
  168.     public function getIsCompleted()
  169.     {
  170.         return $this->is_completed;
  171.     }
  172.     /**
  173.      * @param mixed $is_completed
  174.      */
  175.     public function setIsCompleted($is_completed)
  176.     {
  177.         $this->is_completed $is_completed;
  178.     }
  179.     /**
  180.      * @return mixed
  181.      */
  182.     public function getStartTime()
  183.     {
  184.         return $this->start_time;
  185.     }
  186.     /**
  187.      * @param mixed $start_time
  188.      */
  189.     public function setStartTime($start_time)
  190.     {
  191.         $this->start_time $start_time;
  192.     }
  193.     /**
  194.      * @return mixed
  195.      */
  196.     public function getEndTime()
  197.     {
  198.         return $this->end_time;
  199.     }
  200.     /**
  201.      * @param mixed $end_time
  202.      */
  203.     public function setEndTime($end_time)
  204.     {
  205.         $this->end_time $end_time;
  206.     }
  207.     /**
  208.      * @return mixed
  209.      */
  210.     public function getIsOrderPaid()
  211.     {
  212.         return $this->is_order_paid;
  213.     }
  214.     /**
  215.      * @param mixed $is_order_paid
  216.      */
  217.     public function setIsOrderPaid($is_order_paid)
  218.     {
  219.         $this->is_order_paid $is_order_paid;
  220.     }
  221.     /**
  222.      * @return Orders_Pricing
  223.      */
  224.     public function getOrdersPricing()
  225.     {
  226.         return $this->orders_pricing;
  227.     }
  228.     /**
  229.      * @param mixed $orders_pricing
  230.      */
  231.     public function setOrdersPricing($orders_pricing)
  232.     {
  233.         $this->orders_pricing $orders_pricing;
  234.     }
  235.     /**
  236.      * @return mixed
  237.      */
  238.     public function getIsEmailSent()
  239.     {
  240.         return $this->is_email_sent;
  241.     }
  242.     /**
  243.      * @param mixed $is_email_sent
  244.      */
  245.     public function setIsEmailSent($is_email_sent)
  246.     {
  247.         $this->is_email_sent $is_email_sent;
  248.     }
  249.     /**
  250.      * @return mixed
  251.      */
  252.     public function getIsSmsSent()
  253.     {
  254.         return $this->is_sms_sent;
  255.     }
  256.     /**
  257.      * @param mixed $is_sms_sent
  258.      */
  259.     public function setIsSmsSent($is_sms_sent)
  260.     {
  261.         $this->is_sms_sent $is_sms_sent;
  262.     }
  263.     /**
  264.      * @return mixed
  265.      */
  266.     public function getIsNotificationSent()
  267.     {
  268.         return $this->is_notification_sent;
  269.     }
  270.     /**
  271.      * @param mixed $is_notification_sent
  272.      */
  273.     public function setIsNotificationSent($is_notification_sent)
  274.     {
  275.         $this->is_notification_sent $is_notification_sent;
  276.     }
  277.     /**
  278.      * @return mixed
  279.      */
  280.     public function getIsActive()
  281.     {
  282.         return $this->is_active;
  283.     }
  284.     /**
  285.      * @param mixed $is_active
  286.      */
  287.     public function setIsActive($is_active)
  288.     {
  289.         $this->is_active $is_active;
  290.     }
  291.     /**
  292.      * @return mixed
  293.      */
  294.     public function getWpPayment()
  295.     {
  296.         return $this->wp_payment;
  297.     }
  298.     /**
  299.      * @param mixed $wp_payment
  300.      */
  301.     public function setWpPayment($wp_payment)
  302.     {
  303.         $this->wp_payment $wp_payment;
  304.     }
  305.     /**
  306.      * @return mixed
  307.      */
  308.     public function getPayName()
  309.     {
  310.         return $this->pay_name;
  311.     }
  312.     /**
  313.      * @param mixed $pay_name
  314.      */
  315.     public function setPayName($pay_name)
  316.     {
  317.         $this->pay_name $pay_name;
  318.     }
  319.     /**
  320.      * @return mixed
  321.      */
  322.     public function getPayCardType()
  323.     {
  324.         return $this->pay_card_type;
  325.     }
  326.     /**
  327.      * @param mixed $pay_card_type
  328.      */
  329.     public function setPayCardType($pay_card_type)
  330.     {
  331.         $this->pay_card_type $pay_card_type;
  332.     }
  333.     /**
  334.      * @return mixed
  335.      */
  336.     public function getPayLastFour()
  337.     {
  338.         return $this->pay_last_four;
  339.     }
  340.     /**
  341.      * @param mixed $pay_last_four
  342.      */
  343.     public function setPayLastFour($pay_last_four)
  344.     {
  345.         $this->pay_last_four $pay_last_four;
  346.     }
  347.     /**
  348.      * @return mixed
  349.      */
  350.     public function getPayBrand()
  351.     {
  352.         return $this->pay_brand;
  353.     }
  354.     /**
  355.      * @param mixed $pay_brand
  356.      */
  357.     public function setPayBrand($pay_brand)
  358.     {
  359.         $this->pay_brand $pay_brand;
  360.     }
  361.     /**
  362.      * @return mixed
  363.      */
  364.     public function getPayExpiryMonth()
  365.     {
  366.         return $this->pay_expiry_month;
  367.     }
  368.     /**
  369.      * @param mixed $pay_expiry_month
  370.      */
  371.     public function setPayExpiryMonth($pay_expiry_month)
  372.     {
  373.         $this->pay_expiry_month $pay_expiry_month;
  374.     }
  375.     /**
  376.      * @return mixed
  377.      */
  378.     public function getPayExpiryYear()
  379.     {
  380.         return $this->pay_expiry_year;
  381.     }
  382.     /**
  383.      * @param mixed $pay_expiry_year
  384.      */
  385.     public function setPayExpiryYear($pay_expiry_year)
  386.     {
  387.         $this->pay_expiry_year $pay_expiry_year;
  388.     }
  389.     /**
  390.      * @return Orders
  391.      */
  392.     public function getOrders()
  393.     {
  394.         return $this->orders;
  395.     }
  396.     /**
  397.      * @param mixed $orders
  398.      */
  399.     public function setOrders($orders)
  400.     {
  401.         $this->orders $orders;
  402.     }
  403.     /**
  404.      * @return mixed
  405.      */
  406.     public function getBookingCancelledOn()
  407.     {
  408.         return $this->booking_cancelled_on;
  409.     }
  410.     /**
  411.      * @param mixed $booking_cancelled_on
  412.      */
  413.     public function setBookingCancelledOn($booking_cancelled_on)
  414.     {
  415.         $this->booking_cancelled_on $booking_cancelled_on;
  416.     }
  417.     /**
  418.      * @return mixed
  419.      */
  420.     public function getBookingStatus()
  421.     {
  422.         return $this->booking_status;
  423.     }
  424.     /**
  425.      * @param mixed $booking_status
  426.      */
  427.     public function setBookingStatus($booking_status)
  428.     {
  429.         $this->booking_status $booking_status;
  430.     }
  431.     /**
  432.      * @return mixed
  433.      */
  434.     public function getBookingCancelledReason()
  435.     {
  436.         return $this->booking_cancelled_reason;
  437.     }
  438.     /**
  439.      * @param mixed $booking_cancelled_reason
  440.      */
  441.     public function setBookingCancelledReason($booking_cancelled_reason)
  442.     {
  443.         $this->booking_cancelled_reason $booking_cancelled_reason;
  444.     }
  445.     /**
  446.      * @return mixed
  447.      */
  448.     public function getRefundAmount()
  449.     {
  450.         return $this->refund_amount;
  451.     }
  452.     /**
  453.      * @param mixed $refund_amount
  454.      */
  455.     public function setRefundAmount($refund_amount)
  456.     {
  457.         $this->refund_amount $refund_amount;
  458.     }
  459.     /**
  460.      * @return mixed
  461.      */
  462.     public function getPayStripeCustomerId()
  463.     {
  464.         return $this->pay_stripe_customer_id;
  465.     }
  466.     /**
  467.      * @param mixed $pay_stripe_customer_id
  468.      */
  469.     public function setPayStripeCustomerId($pay_stripe_customer_id)
  470.     {
  471.         $this->pay_stripe_customer_id $pay_stripe_customer_id;
  472.     }
  473.     /**
  474.      * @return mixed
  475.      */
  476.     public function getPayStripeCardId()
  477.     {
  478.         return $this->pay_stripe_card_id;
  479.     }
  480.     /**
  481.      * @param mixed $pay_stripe_card_id
  482.      */
  483.     public function setPayStripeCardId($pay_stripe_card_id)
  484.     {
  485.         $this->pay_stripe_card_id $pay_stripe_card_id;
  486.     }
  487.     /**
  488.      * @return mixed
  489.      */
  490.     public function getPaymentMethodType()
  491.     {
  492.         return $this->payment_method_type;
  493.     }
  494.     /**
  495.      * @param mixed $payment_method_type
  496.      */
  497.     public function setPaymentMethodType($payment_method_type)
  498.     {
  499.         $this->payment_method_type $payment_method_type;
  500.     }
  501.     /**
  502.      * @return mixed
  503.      */
  504.     public function getPayStripePaymentIntentId()
  505.     {
  506.         return $this->pay_stripe_payment_intent_id;
  507.     }
  508.     /**
  509.      * @param mixed $pay_stripe_payment_intent_id
  510.      */
  511.     public function setPayStripePaymentIntentId($pay_stripe_payment_intent_id)
  512.     {
  513.         $this->pay_stripe_payment_intent_id $pay_stripe_payment_intent_id;
  514.     }
  515.     /**
  516.      * @return mixed
  517.      */
  518.     public function getPayStripePaymentMethodId()
  519.     {
  520.         return $this->pay_stripe_payment_method_id;
  521.     }
  522.     /**
  523.      * @param mixed $pay_stripe_payment_method_id
  524.      */
  525.     public function setPayStripePaymentMethodId($pay_stripe_payment_method_id)
  526.     {
  527.         $this->pay_stripe_payment_method_id $pay_stripe_payment_method_id;
  528.     }
  529.     public function jsonSerialize()
  530.     {
  531.         return array(
  532.             'id' => $this->id,
  533.             'is_completed' => $this->is_completed,
  534.             'start_time' => $this->start_time->format('Y-m-d H:i:s'),
  535.             'end_time' => $this->end_time->format('Y-m-d H:i:s'),
  536.             'is_order_paid' => $this->is_order_paid,
  537.             'is_email_sent' => $this->is_email_sent,
  538.             'is_sms_sent' => $this->is_sms_sent,
  539.             'is_notification_sent' => $this->is_notification_sent,
  540.             'hourly_rate' => $this->orders_pricing->getHourlyRate(),
  541.             'daily_max' => $this->orders_pricing->getDailyMax(),
  542.             'sub_total_price' => $this->orders_pricing->getSubTotalPrice(),
  543.             'tax_price' => $this->orders_pricing->getTaxPrice(),
  544.             'service_fee_price' => $this->orders_pricing->getServiceFeePrice(),
  545.             'total_price' => $this->orders_pricing->getTotalPrice(),
  546.             'wp_payment_id' => $this->getWpPayment() != NULL $this->getWpPayment()->getId() : '',
  547.             'pay_name' => $this->pay_name,
  548.             'pay_brand' => $this->pay_brand,
  549.             'pay_card_type' => $this->pay_card_type,
  550.             'pay_expiry_month' => $this->pay_expiry_month,
  551.             'pay_expiry_year' => $this->pay_expiry_year,
  552.             'pay_last_four' => $this->pay_last_four,
  553.             'booking_cancelled_on' => $this->booking_cancelled_on == NULL '' $this->booking_cancelled_on->format('Y-m-d H:i:s'),
  554.             'booking_cancelled_reason' => $this->booking_cancelled_reason,
  555.             'booking_status' => $this->booking_status,
  556.             'refund_amount' => $this->refund_amount,
  557.             'without_discount_sub_total_price' => $this->orders_pricing->getWithoutDiscountSubTotalPrice(),
  558.             'without_discount_tax_price' => $this->orders_pricing->getWithoutDiscountTaxPrice(),
  559.             'without_discount_service_fee_price' => $this->orders_pricing->getWithoutDiscountServiceFeePrice(),
  560.             'without_discount_total_price' => $this->orders_pricing->getWithoutDiscountTotalPrice(),
  561.             'discount_total' => $this->orders_pricing->getDiscountTotal(),
  562.             'promo_code' => $this->getOrdersPricing()->getPromoCode() != NULL $this->getOrdersPricing()->getPromoCode()->jsonSerialize() : NULL,
  563.             'is_discount_applicable' => $this->orders_pricing->getIsDiscountApplicable(),
  564.         );
  565.     }
  566.     /**
  567.      * @var string $created
  568.      *
  569.      * @ORM\Column(name="created_at", type="string", nullable=false)
  570.      */
  571.     protected $createdAt;
  572.     /**
  573.      * @var string $updated
  574.      *
  575.      * @ORM\Column(name="updated_at", type="string", nullable=false)
  576.      */
  577.     protected $updatedAt;
  578.     public function getCreatedAt()
  579.     {
  580.         return $this->createdAt;
  581.     }
  582.     public function setCreatedAt($createdAt)
  583.     {
  584.         $this->createdAt $createdAt;
  585.         return $this;
  586.     }
  587.     public function getUpdatedAt()
  588.     {
  589.         return $this->updatedAt;
  590.     }
  591.     public function setUpdatedAt($updatedAt)
  592.     {
  593.         $this->updatedAt $updatedAt;
  594.         return $this;
  595.     }
  596.     /**
  597.      * @ORM\PrePersist
  598.      * @ORM\PreUpdate
  599.      */
  600.     public function updatedTimestamps()
  601.     {
  602.         $this->setUpdatedAt(round(microtime(true) * 1000));
  603.         if ($this->getCreatedAt() === null) {
  604.             $this->setCreatedAt(round(microtime(true) * 1000));
  605.         }
  606.     }
  607.     public function __construct() {
  608.         $this->setCreatedAt(round(microtime(true) * 1000));
  609.     }
  610. }