<?php
namespace Plugin\RegularPurchase\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Plugin\RegularPurchase\Entity\RegularPurchaseDetail;
use Doctrine\ORM\Mapping as ORM;
if (!class_exists('\Plugin\RegularPurchase\Entity\RegularPurchase', false)) {
/**
* RegularPurchase
*
* @ORM\Table(name="plg_regular_purchase")
* @ORM\Entity(repositoryClass="Plugin\RegularPurchase\Repository\RegularPurchaseRepository")
*/
class RegularPurchase
{
public function __construct()
{
$this->details = new ArrayCollection();
$this->RegularPurchaseShippings = new ArrayCollection();
}
public function __toString()
{
return (string) $this->subscription_number ?: '(新規)';
}
/**
* @var int
*
* @ORM\Column(name="id", type="integer", options={"unsigned":true})
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="subscription_number", type="string", length=255)
*/
private $subscription_number;
/**
* @var DateTime
*
* @ORM\Column(name="next_shipping_date", type="datetimetz", nullable=true)
*/
private $nextShippingDate;
/**
* @var DateTime
*
* @ORM\Column(name="next_delivery_date", type="datetimetz", nullable=true)
*/
private $nextDeliveryDate;
/**
* @var int
*
* @ORM\Column(name="delivery_day", type="integer", options={"default":1}, nullable=true)
*/
private $delivery_day;
/**
* @var int
* @ORM\Column(name="delivery_option1", type="integer", options={"default":0}, nullable=true)
*/
private $delivery_option1;
/**
* @var int
* @ORM\Column(name="delivery_option2", type="integer", options={"default":0}, nullable=true)
*/
private $delivery_option2;
/**
* @var \Eccube\Entity\Payment
*
* @ORM\ManyToOne(targetEntity="Eccube\Entity\Payment")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="payment_id", referencedColumnName="id")
* })
*/
private $Payment;
/**
* @var DateTime
*
* @ORM\Column(name="create_date", type="datetimetz", options={"default": "CURRENT_TIMESTAMP"}, nullable=true)
*/
private $createDate;
/**
* @var DateTime
*
* @ORM\Column(name="update_date", type="datetimetz", options={"default": "CURRENT_TIMESTAMP", "onUpdate": "CURRENT_TIMESTAMP"}, nullable=true)
*/
private $updateDate;
//Customer
/**
* @var \Eccube\Entity\Customer
*
* @ORM\ManyToOne(targetEntity="Eccube\Entity\Customer")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
* })
*/
private $Customer;
/**
* @return \Eccube\Entity\Customer
*/
public function getCustomer()
{
return $this->Customer;
}
/**
* @param \Eccube\Entity\Customer $Customer
*
* @return RegularPurchase
*/
public function setCustomer($Customer)
{
$this->Customer = $Customer;
return $this;
}
// 状態フラグの変更 ・・・ 1:継続、0:休止、-1:解約
/**
* @var int
*
* @ORM\Column(name="status", type="integer", options={"default":1})
*/
private $status = 1;
/**
* @return int
*/
public function getStatus()
{
return $this->status;
}
/**
* @param int $status
*
* @return RegularPurchase
*/
public function setStatus($status)
{
$this->status = $status;
return $this;
}
/**
* @var Collection|RegularPurchaseDetail[]
*
* @ORM\OneToMany(targetEntity="Plugin\RegularPurchase\Entity\RegularPurchaseDetail", mappedBy="regularPurchase", cascade={"persist", "remove"}, orphanRemoval=true)
*/
private $details;
/**
* @var Collection|RegularPurchaseShipping[]
*
* @ORM\OneToMany(targetEntity="Plugin\RegularPurchase\Entity\RegularPurchaseShipping", mappedBy="regularPurchase", cascade={"persist", "remove"}, orphanRemoval=true)
*/
private $RegularPurchaseShippings;
/**
* @return Collection|RegularPurchaseShipping[]
*/
public function getRegularPurchaseShippings(): Collection
{
return $this->RegularPurchaseShippings;
}
public function addRegularPurchaseShipping(RegularPurchaseShipping $RegularPurchaseShipping): self
{
if (!$this->RegularPurchaseShippings->contains($RegularPurchaseShipping)) {
$this->RegularPurchaseShippings[] = $RegularPurchaseShipping;
$RegularPurchaseShipping->setRegularPurchase($this);
}
return $this;
}
public function removeRegularPurchaseShipping(RegularPurchaseShipping $RegularPurchaseShipping): self
{
if ($this->RegularPurchaseShippings->contains($RegularPurchaseShipping)) {
$this->RegularPurchaseShippings->removeElement($RegularPurchaseShipping);
// set the owning side to null (unless already changed)
if ($RegularPurchaseShipping->getRegularPurchase() === $this) {
$RegularPurchaseShipping->setRegularPurchase(null);
}
}
return $this;
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return string
*/
public function getSubscriptionNumber()
{
return $this->subscription_number;
}
/**
* @param string $name
*
* @return $this;
*/
public function setSubscriptionNumber($subscription_number)
{
$this->subscription_number = $subscription_number;
return $this;
}
public function getDetails(): Collection
{
return $this->details;
}
public function addDetail(RegularPurchaseDetail $detail): self
{
if (!$this->details->contains($detail)) {
$this->details[] = $detail;
$detail->setRegularPurchase($this);
}
return $this;
}
public function removeDetail(RegularPurchaseDetail $detail): self
{
if ($this->details->contains($detail)) {
$this->details->removeElement($detail);
if ($detail->getRegularPurchase() === $this) {
$detail->setRegularPurchase(null);
}
}
return $this;
}
public function getNextShippingDate(): ?\DateTimeInterface
{
if ($this->nextShippingDate) {
$this->nextShippingDate->setTimezone(new \DateTimeZone('Asia/Tokyo'))
->setTime(0, 0, 0);
}
return $this->nextShippingDate;
}
public function setNextShippingDate(?\DateTimeInterface $nextShippingDate): self
{
if ($nextShippingDate) {
$nextShippingDate->setTimezone(new \DateTimeZone('Asia/Tokyo'))
->setTime(0, 0, 0);
}
$this->nextShippingDate = $nextShippingDate;
return $this;
}
public function getNextDeliveryDate(): ?\DateTimeInterface
{
if ($this->nextDeliveryDate) {
$this->nextDeliveryDate->setTimezone(new \DateTimeZone('Asia/Tokyo'))
->setTime(0, 0, 0);
}
return $this->nextDeliveryDate;
}
public function setNextDeliveryDate(?\DateTimeInterface $nextDeliveryDate): self
{
if ($nextDeliveryDate) {
$nextDeliveryDate->setTimezone(new \DateTimeZone('Asia/Tokyo'))
->setTime(0, 0, 0);
}
$this->nextDeliveryDate = $nextDeliveryDate;
return $this;
}
public function getPayment()
{
return $this->Payment;
}
public function setPayment($Payment)
{
$this->Payment = $Payment;
return $this;
}
public function getDeliveryDay()
{
return $this->delivery_day;
}
public function setDeliveryDay($delivery_day)
{
$this->delivery_day = $delivery_day;
return $this;
}
public function getCreateDate()
{
return $this->createDate;
}
public function setCreateDate($createDate)
{
$this->createDate = $createDate;
return $this;
}
public function getUpdateDate()
{
return $this->updateDate;
}
public function setUpdateDate($updateDate)
{
$this->updateDate = $updateDate;
return $this;
}
public function getDeliveryOption1()
{
return $this->delivery_option1;
}
public function setDeliveryOption1($delivery_option1)
{
$this->delivery_option1 = $delivery_option1;
return $this;
}
public function getDeliveryOption2()
{
return $this->delivery_option2;
}
public function setDeliveryOption2($delivery_option2)
{
$this->delivery_option2 = $delivery_option2;
return $this;
}
}
}