<?php
namespace App\AppBundle\MainBundle\Entity;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use PetstoreIO\Order;
use Symfony\Component\Validator\Constraints as Assert;
use JsonSerializable;
/**
* AddOns
*
* @ORM\Entity
* @ORM\Table(name="orders_refund")
* @ORM\HasLifecycleCallbacks()
*/
class Orders_Refund implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var Orders
* @ORM\OneToOne(targetEntity="Orders", inversedBy="order_refund")
* @ORM\JoinColumn(name="order_id", referencedColumnName="id")
*/
private $order;
/**
* @ORM\Column(type="decimal", precision=10, scale=2)
* @Assert\NotBlank()
*/
private $refund_amount;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $refund_comment;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $refund_status;//BookingStatus Constants for Refund Status
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $refund_stripe_id;
/**
* @var DateTime
* @ORM\Column(type="datetime", nullable=true)
* @Assert\NotBlank()
*/
private $refund_processed_date;
/**
* @var DateTime
* @ORM\Column(type="datetime", nullable=true)
* @Assert\NotBlank()
*/
private $refund_initiated_date;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
* @Assert\NotBlank()
*/
private $hold_refund = false;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return Orders
*/
public function getOrder()
{
return $this->order;
}
/**
* @param Orders $order
*/
public function setOrder(Orders $order)
{
$this->order = $order;
}
/**
* @return mixed
*/
public function getRefundAmount()
{
return $this->refund_amount;
}
/**
* @param mixed $refund_amount
*/
public function setRefundAmount($refund_amount)
{
$this->refund_amount = $refund_amount;
}
/**
* @return mixed
*/
public function getRefundComment()
{
return $this->refund_comment;
}
/**
* @param mixed $refund_comment
*/
public function setRefundComment($refund_comment)
{
$this->refund_comment = $refund_comment;
}
/**
* @return mixed
*/
public function getRefundStatus()
{
return $this->refund_status;
}
/**
* @param mixed $refund_status
*/
public function setRefundStatus($refund_status)
{
$this->refund_status = $refund_status;
}
/**
* @return mixed
*/
public function getRefundStripeId()
{
return $this->refund_stripe_id;
}
/**
* @param mixed $refund_stripe_id
*/
public function setRefundStripeId($refund_stripe_id)
{
$this->refund_stripe_id = $refund_stripe_id;
}
/**
* @return DateTime
*/
public function getRefundProcessedDate()
{
return $this->refund_processed_date;
}
/**
* @param DateTime $refund_processed_date
*/
public function setRefundProcessedDate(DateTime $refund_processed_date)
{
$this->refund_processed_date = $refund_processed_date;
}
/**
* @return mixed
*/
public function getHoldRefund()
{
return $this->hold_refund;
}
/**
* @param mixed $hold_refund
*/
public function setHoldRefund($hold_refund)
{
$this->hold_refund = $hold_refund;
}
/**
* @return DateTime
*/
public function getRefundInitiatedDate()
{
return $this->refund_initiated_date;
}
/**
* @param DateTime $refund_initiated_date
*/
public function setRefundInitiatedDate(DateTime $refund_initiated_date)
{
$this->refund_initiated_date = $refund_initiated_date;
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
'order_id' => $this->order->getId(),
'refund_amount' => $this->refund_amount,
'refund_comment' => $this->refund_comment,
'refund_status' => $this->refund_status,
'refund_stripe_id' => $this->refund_stripe_id,
'hold_refund' => $this->hold_refund,
'refund_processed_date' => $this->refund_processed_date->format('Y-m-d H:i:s'),
'refund_initiated_date' => $this->refund_initiated_date->format('Y-m-d H:i:s'),
'created' => $this->createdAt->format('Y-m-d H:i:s'),
'updated' => $this->updatedAt->format('Y-m-d H:i:s'),
);
}
/**
* @var DateTime $created
*
* @ORM\Column(type="datetime", nullable=false)
*/
protected $createdAt;
/**
* @var DateTime $updated
*
* @ORM\Column(type="datetime", nullable=false)
*/
protected $updatedAt;
/**
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @return DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @ORM\PrePersist
*/
public function setCreatedAt()
{
$this->createdAt = new DateTime();
$this->updatedAt = new DateTime();
return $this;
}
/**
* @ORM\PreUpdate
*/
public function setUpdatedAtValue() {
$this->updatedAt = new DateTime();
}
public function __construct() {
}
}