app/Plugin/RegularPurchase/Entity/RegularPurchase.php line 17

Open in your IDE?
  1. <?php
  2. namespace Plugin\RegularPurchase\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Plugin\RegularPurchase\Entity\RegularPurchaseDetail;
  6. use Doctrine\ORM\Mapping as ORM;
  7. if (!class_exists('\Plugin\RegularPurchase\Entity\RegularPurchase'false)) {
  8.     /**
  9.      * RegularPurchase
  10.      *
  11.      * @ORM\Table(name="plg_regular_purchase")
  12.      * @ORM\Entity(repositoryClass="Plugin\RegularPurchase\Repository\RegularPurchaseRepository")
  13.      */
  14.     class RegularPurchase
  15.     {
  16.         public function __construct()
  17.         {
  18.             $this->details = new ArrayCollection();
  19.             $this->RegularPurchaseShippings = new ArrayCollection();
  20.         }
  21.         public function __toString()
  22.         {
  23.             return (string) $this->subscription_number ?: '(新規)';
  24.         }
  25.         /**
  26.          * @var int
  27.          *
  28.          * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  29.          * @ORM\Id
  30.          * @ORM\GeneratedValue(strategy="IDENTITY")
  31.          */
  32.         private $id;
  33.         /**
  34.          * @var string
  35.          *
  36.          * @ORM\Column(name="subscription_number", type="string", length=255)
  37.          */
  38.         private $subscription_number;
  39.         
  40.         /**
  41.          * @var DateTime
  42.          *
  43.          * @ORM\Column(name="next_shipping_date", type="datetimetz", nullable=true)
  44.          */
  45.         private $nextShippingDate;
  46.         /**
  47.          * @var DateTime
  48.          *
  49.          * @ORM\Column(name="next_delivery_date", type="datetimetz", nullable=true)
  50.          */
  51.         private $nextDeliveryDate;
  52.         /**
  53.          * @var int
  54.          * 
  55.          * @ORM\Column(name="delivery_day", type="integer", options={"default":1}, nullable=true)
  56.          */
  57.                 
  58.         private $delivery_day;
  59.         /**
  60.          * @var int
  61.          * @ORM\Column(name="delivery_option1", type="integer", options={"default":0}, nullable=true)
  62.          */
  63.         private $delivery_option1;
  64.         /**
  65.          * @var int
  66.          * @ORM\Column(name="delivery_option2", type="integer", options={"default":0}, nullable=true)
  67.          */
  68.         private $delivery_option2;
  69.        
  70.          
  71.         /**
  72.          * @var \Eccube\Entity\Payment
  73.          *
  74.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Payment")
  75.          * @ORM\JoinColumns({
  76.          *   @ORM\JoinColumn(name="payment_id", referencedColumnName="id")
  77.          * })
  78.          */
  79.         private $Payment;
  80.         
  81.         /**
  82.          * @var DateTime
  83.          *
  84.          * @ORM\Column(name="create_date", type="datetimetz", options={"default": "CURRENT_TIMESTAMP"}, nullable=true)
  85.          */
  86.         private $createDate;
  87.         /**
  88.          * @var DateTime
  89.          *
  90.          * @ORM\Column(name="update_date", type="datetimetz", options={"default": "CURRENT_TIMESTAMP", "onUpdate": "CURRENT_TIMESTAMP"}, nullable=true)
  91.          */
  92.         private $updateDate;
  93.         //Customer
  94.         /**
  95.          * @var \Eccube\Entity\Customer
  96.          *
  97.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Customer")
  98.          * @ORM\JoinColumns({
  99.          *   @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
  100.          * })
  101.          */
  102.         private $Customer;
  103.         /**
  104.          * @return \Eccube\Entity\Customer
  105.          */
  106.         public function getCustomer()
  107.         {
  108.             return $this->Customer;
  109.         }
  110.         /**
  111.          * @param \Eccube\Entity\Customer $Customer
  112.          *
  113.          * @return RegularPurchase
  114.          */
  115.         public function setCustomer($Customer)
  116.         {
  117.             $this->Customer $Customer;
  118.             return $this;
  119.         }
  120.         // 状態フラグの変更 ・・・ 1:継続、0:休止、-1:解約
  121.         /**
  122.          * @var int
  123.          *
  124.          * @ORM\Column(name="status", type="integer", options={"default":1})
  125.          */
  126.         private $status 1;
  127.         /**
  128.          * @return int
  129.          */
  130.         public function getStatus()
  131.         {
  132.             return $this->status;
  133.         }
  134.         /**
  135.          * @param int $status
  136.          *
  137.          * @return RegularPurchase
  138.          */
  139.         public function setStatus($status)
  140.         {
  141.             $this->status $status;
  142.             return $this;
  143.         }
  144.         /**
  145.          * @var Collection|RegularPurchaseDetail[]
  146.          *
  147.          * @ORM\OneToMany(targetEntity="Plugin\RegularPurchase\Entity\RegularPurchaseDetail", mappedBy="regularPurchase", cascade={"persist", "remove"}, orphanRemoval=true)
  148.          */
  149.         private $details;
  150.                 /**
  151.          * @var Collection|RegularPurchaseShipping[]
  152.          * 
  153.          * @ORM\OneToMany(targetEntity="Plugin\RegularPurchase\Entity\RegularPurchaseShipping", mappedBy="regularPurchase", cascade={"persist", "remove"}, orphanRemoval=true)
  154.          */
  155.         private $RegularPurchaseShippings;
  156.         /**
  157.          * @return Collection|RegularPurchaseShipping[]
  158.          */
  159.         public function getRegularPurchaseShippings(): Collection
  160.         {
  161.             return $this->RegularPurchaseShippings;
  162.         }
  163.         
  164.         public function addRegularPurchaseShipping(RegularPurchaseShipping $RegularPurchaseShipping): self
  165.         {
  166.             if (!$this->RegularPurchaseShippings->contains($RegularPurchaseShipping)) {
  167.                 $this->RegularPurchaseShippings[] = $RegularPurchaseShipping;
  168.                 $RegularPurchaseShipping->setRegularPurchase($this);
  169.             }
  170.             return $this;
  171.         }
  172.         public function removeRegularPurchaseShipping(RegularPurchaseShipping $RegularPurchaseShipping): self
  173.         {
  174.             if ($this->RegularPurchaseShippings->contains($RegularPurchaseShipping)) {
  175.                 $this->RegularPurchaseShippings->removeElement($RegularPurchaseShipping);
  176.                 // set the owning side to null (unless already changed)
  177.                 if ($RegularPurchaseShipping->getRegularPurchase() === $this) {
  178.                     $RegularPurchaseShipping->setRegularPurchase(null);
  179.                 }
  180.             }
  181.             return $this;
  182.         }
  183.         /**
  184.          * @return int
  185.          */
  186.         public function getId()
  187.         {
  188.             return $this->id;
  189.         }
  190.         /**
  191.          * @return string
  192.          */
  193.         public function getSubscriptionNumber()
  194.         {
  195.             return $this->subscription_number;
  196.         }
  197.         /**
  198.          * @param string $name
  199.          *
  200.          * @return $this;
  201.          */
  202.         public function setSubscriptionNumber($subscription_number)
  203.         {
  204.             $this->subscription_number $subscription_number;
  205.             return $this;
  206.         }
  207.         public function getDetails(): Collection
  208.         {
  209.             return $this->details;
  210.         }
  211.         public function addDetail(RegularPurchaseDetail $detail): self
  212.         {
  213.             if (!$this->details->contains($detail)) {
  214.                 $this->details[] = $detail;
  215.                 $detail->setRegularPurchase($this);
  216.             }
  217.             return $this;
  218.         }
  219.         public function removeDetail(RegularPurchaseDetail $detail): self
  220.         {
  221.             if ($this->details->contains($detail)) {
  222.                 $this->details->removeElement($detail);
  223.                 if ($detail->getRegularPurchase() === $this) {
  224.                     $detail->setRegularPurchase(null);
  225.                 }
  226.             }
  227.             return $this;
  228.         }
  229.         public function getNextShippingDate(): ?\DateTimeInterface
  230.         {
  231.             if ($this->nextShippingDate) {
  232.                 $this->nextShippingDate->setTimezone(new \DateTimeZone('Asia/Tokyo'))
  233.                 ->setTime(000);
  234.             }
  235.             return $this->nextShippingDate;
  236.         }
  237.         public function setNextShippingDate(?\DateTimeInterface $nextShippingDate): self
  238.         {
  239.             if ($nextShippingDate) {
  240.                 $nextShippingDate->setTimezone(new \DateTimeZone('Asia/Tokyo'))
  241.                 ->setTime(000);
  242.             }
  243.             $this->nextShippingDate $nextShippingDate;
  244.             return $this;
  245.         }
  246.         public function getNextDeliveryDate(): ?\DateTimeInterface
  247.         {
  248.             if ($this->nextDeliveryDate) {
  249.                 $this->nextDeliveryDate->setTimezone(new \DateTimeZone('Asia/Tokyo'))
  250.                 ->setTime(000);
  251.             }
  252.             return $this->nextDeliveryDate;
  253.         }
  254.         public function setNextDeliveryDate(?\DateTimeInterface $nextDeliveryDate): self
  255.         {
  256.             if ($nextDeliveryDate) {
  257.                 $nextDeliveryDate->setTimezone(new \DateTimeZone('Asia/Tokyo'))
  258.                 ->setTime(000);
  259.             }
  260.             $this->nextDeliveryDate $nextDeliveryDate;
  261.             return $this;
  262.         }
  263.         public function getPayment()
  264.         {
  265.             return $this->Payment;
  266.         }
  267.         public function setPayment($Payment)
  268.         {
  269.             $this->Payment $Payment;
  270.             return $this;
  271.         }
  272.         public function getDeliveryDay()
  273.         {
  274.             return $this->delivery_day;
  275.         }
  276.         public function setDeliveryDay($delivery_day)
  277.         {
  278.             $this->delivery_day $delivery_day;
  279.             return $this;
  280.         }
  281.         public function getCreateDate()
  282.         {
  283.             return $this->createDate;
  284.         }
  285.         public function setCreateDate($createDate)
  286.         {
  287.             $this->createDate $createDate;
  288.             return $this;
  289.         }
  290.         public function getUpdateDate()
  291.         {
  292.             return $this->updateDate;
  293.         }
  294.         public function setUpdateDate($updateDate)
  295.         {
  296.             $this->updateDate $updateDate;
  297.             return $this;
  298.         }
  299.         public function getDeliveryOption1()
  300.         {
  301.             return $this->delivery_option1;
  302.         }
  303.         public function setDeliveryOption1($delivery_option1)
  304.         {
  305.             $this->delivery_option1 $delivery_option1;
  306.             return $this;
  307.         }
  308.         public function getDeliveryOption2()
  309.         {
  310.             return $this->delivery_option2;
  311.         }
  312.         public function setDeliveryOption2($delivery_option2)
  313.         {
  314.             $this->delivery_option2 $delivery_option2;
  315.             return $this;
  316.         }
  317.     }
  318. }