app/Plugin/RegularPurchase/Entity/RegularPurchaseShipping.php line 39

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.ec-cube.co.jp/
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Plugin\RegularPurchase\Entity;
  13. use Doctrine\ORM\Mapping as ORM;
  14. use Doctrine\Common\Collections\ArrayCollection;
  15. use Doctrine\Common\Collections\Collection;
  16. use Plugin\RegularPurchase\Entity\RegularPurchaseDetail;
  17. use Plugin\RegularPurchase\Entity\RegularPurchase;
  18. use Eccube\Entity\Master\Pref;
  19. use Eccube\Entity\Delivery;
  20. use Eccube\Entity\Master\Country;
  21. use Eccube\Entity\Member;
  22. use Eccube\Entity\Shipping;
  23. if (!class_exists('\Plugin\RegularPurchase\Entity\\RegularPurchaseShipping'false)) {
  24.     /**
  25.      * RegularPurchaseShipping
  26.      *
  27.      * @ORM\Table(name="plg_regular_purchase_shipping")
  28.      * @ORM\InheritanceType("SINGLE_TABLE")
  29.      * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
  30.      * @ORM\HasLifecycleCallbacks()
  31.      * @ORM\Entity(repositoryClass="Plugin\RegularPurchase\Repository\RegularPurchaseShippingRepository")
  32.      */
  33.     class RegularPurchaseShipping
  34.     {
  35.         /**
  36.          * @var int
  37.          *
  38.          * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  39.          * @ORM\Id
  40.          * @ORM\GeneratedValue(strategy="IDENTITY")
  41.          */
  42.         private $id;
  43.         /**
  44.          * @var string
  45.          *
  46.          * @ORM\Column(name="name01", type="string", length=255)
  47.          */
  48.         private $name01;
  49.         /**
  50.          * @var string
  51.          *
  52.          * @ORM\Column(name="name02", type="string", length=255)
  53.          */
  54.         private $name02;
  55.         /**
  56.          * @var string
  57.          *
  58.          * @ORM\Column(name="kana01", type="string", length=255, nullable=true)
  59.          */
  60.         private $kana01;
  61.         /**
  62.          * @var string
  63.          *
  64.          * @ORM\Column(name="kana02", type="string", length=255, nullable=true)
  65.          */
  66.         private $kana02;
  67.         /**
  68.          * @var string|null
  69.          *
  70.          * @ORM\Column(name="company_name", type="string", length=255, nullable=true)
  71.          */
  72.         private $company_name;
  73.         /**
  74.          * @var string|null
  75.          *
  76.          * @ORM\Column(name="phone_number", type="string", length=14, nullable=true)
  77.          */
  78.         private $phone_number;
  79.         /**
  80.          * @var string|null
  81.          *
  82.          * @ORM\Column(name="postal_code", type="string", length=8, nullable=true)
  83.          */
  84.         private $postal_code;
  85.         /**
  86.          * @var string|null
  87.          *
  88.          * @ORM\Column(name="addr01", type="string", length=255, nullable=true)
  89.          */
  90.         private $addr01;
  91.         /**
  92.          * @var string|null
  93.          *
  94.          * @ORM\Column(name="addr02", type="string", length=255, nullable=true)
  95.          */
  96.         private $addr02;
  97.         /**
  98.          * @var string|null
  99.          *
  100.          * @ORM\Column(name="delivery_name", type="string", length=255, nullable=true)
  101.          */
  102.         private $shipping_delivery_name;
  103.         /**
  104.          * @var \Eccube\Entity\DeliveryTime
  105.          *
  106.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\DeliveryTime")
  107.          * @ORM\JoinColumns({
  108.          *   @ORM\JoinColumn(name="time_id", referencedColumnName="id")
  109.          * })
  110.          */
  111.         private $DeliveryTime;
  112.         /**
  113.          * @var string
  114.          *
  115.          * @ORM\Column(name="note", type="string", length=4000, nullable=true)
  116.          */
  117.         private $note;
  118.         /**
  119.          * @var \DateTime
  120.          *
  121.          * @ORM\Column(name="create_date", type="datetimetz")
  122.          */
  123.         private $create_date;
  124.         /**
  125.          * @var \DateTime
  126.          *
  127.          * @ORM\Column(name="update_date", type="datetimetz")
  128.          */
  129.         private $update_date;
  130.         /**
  131.          * @var \Plugin\RegularPurchase\Entity\RegularPurchase
  132.          *
  133.          * @ORM\ManyToOne(targetEntity="Plugin\RegularPurchase\Entity\RegularPurchase", inversedBy="details")
  134.          * @ORM\JoinColumn(name="regular_purchase_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
  135.          */
  136.         private $regularPurchase;
  137.         /**
  138.          * @var Collection|RegularPurchaseDetail[]
  139.          *
  140.          * @ORM\OneToMany(targetEntity="Plugin\RegularPurchase\Entity\RegularPurchaseDetail", mappedBy="regularPurchase", cascade={"persist", "remove"}, orphanRemoval=true)
  141.          */
  142.         private $details;
  143.         /**
  144.          * @var \Eccube\Entity\Master\Country
  145.          *
  146.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Country")
  147.          * @ORM\JoinColumns({
  148.          *   @ORM\JoinColumn(name="country_id", referencedColumnName="id")
  149.          * })
  150.          */
  151.         private $Country;
  152.         /**
  153.          * @var \Eccube\Entity\Master\Pref
  154.          *
  155.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Pref")
  156.          * @ORM\JoinColumns({
  157.          *   @ORM\JoinColumn(name="pref_id", referencedColumnName="id")
  158.          * })
  159.          */
  160.         private $Pref;
  161.         /**
  162.          * @var \Eccube\Entity\Delivery
  163.          *
  164.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Delivery")
  165.          * @ORM\JoinColumns({
  166.          *   @ORM\JoinColumn(name="delivery_id", referencedColumnName="id")
  167.          * })
  168.          */
  169.         private $Delivery;
  170.         /**
  171.          * @var \Eccube\Entity\Member
  172.          *
  173.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Member")
  174.          * @ORM\JoinColumns({
  175.          *   @ORM\JoinColumn(name="creator_id", referencedColumnName="id")
  176.          * })
  177.          */
  178.         private $Creator;
  179.         /**
  180.          * @var \Eccube\Entity\Shipping
  181.          *
  182.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Shipping")
  183.          * @ORM\JoinColumns({
  184.          *   @ORM\JoinColumn(name="shipping_id", referencedColumnName="id")
  185.          * })
  186.          */
  187.         private $Shipping;
  188.         /**
  189.          * Constructor
  190.          */
  191.         public function __construct()
  192.         {
  193.             $this->details = new ArrayCollection();
  194.         }
  195.         
  196.         /**
  197.          * Get id.
  198.          *
  199.          * @return int
  200.          */
  201.         public function getId()
  202.         {
  203.             return $this->id;
  204.         }
  205.         /**
  206.          * Set name01.
  207.          *
  208.          * @param string $name01
  209.          *
  210.          * @return Shipping
  211.          */
  212.         public function setName01($name01)
  213.         {
  214.             $this->name01 $name01;
  215.             return $this;
  216.         }
  217.         /**
  218.          * Get name01.
  219.          *
  220.          * @return string
  221.          */
  222.         public function getName01()
  223.         {
  224.             return $this->name01;
  225.         }
  226.         /**
  227.          * Set name02.
  228.          *
  229.          * @param string $name02
  230.          *
  231.          * @return Shipping
  232.          */
  233.         public function setName02($name02)
  234.         {
  235.             $this->name02 $name02;
  236.             return $this;
  237.         }
  238.         /**
  239.          * Get name02.
  240.          *
  241.          * @return string
  242.          */
  243.         public function getName02()
  244.         {
  245.             return $this->name02;
  246.         }
  247.         /**
  248.          * Set kana01.
  249.          *
  250.          * @param string $kana01
  251.          *
  252.          * @return Shipping
  253.          */
  254.         public function setKana01($kana01)
  255.         {
  256.             $this->kana01 $kana01;
  257.             return $this;
  258.         }
  259.         /**
  260.          * Get kana01.
  261.          *
  262.          * @return string
  263.          */
  264.         public function getKana01()
  265.         {
  266.             return $this->kana01;
  267.         }
  268.         /**
  269.          * Set kana02.
  270.          *
  271.          * @param string $kana02
  272.          *
  273.          * @return Shipping
  274.          */
  275.         public function setKana02($kana02)
  276.         {
  277.             $this->kana02 $kana02;
  278.             return $this;
  279.         }
  280.         /**
  281.          * Get kana02.
  282.          *
  283.          * @return string
  284.          */
  285.         public function getKana02()
  286.         {
  287.             return $this->kana02;
  288.         }
  289.         /**
  290.          * Set companyName.
  291.          *
  292.          * @param string|null $companyName
  293.          *
  294.          * @return Shipping
  295.          */
  296.         public function setCompanyName($companyName null)
  297.         {
  298.             $this->company_name $companyName;
  299.             return $this;
  300.         }
  301.         /**
  302.          * Get companyName.
  303.          *
  304.          * @return string|null
  305.          */
  306.         public function getCompanyName()
  307.         {
  308.             return $this->company_name;
  309.         }
  310.         /**
  311.          * Set phone_number.
  312.          *
  313.          * @param string|null $phone_number
  314.          *
  315.          * @return Shipping
  316.          */
  317.         public function setPhoneNumber($phone_number null)
  318.         {
  319.             $this->phone_number $phone_number;
  320.             return $this;
  321.         }
  322.         /**
  323.          * Get phone_number.
  324.          *
  325.          * @return string|null
  326.          */
  327.         public function getPhoneNumber()
  328.         {
  329.             return $this->phone_number;
  330.         }
  331.         /**
  332.          * Set postal_code.
  333.          *
  334.          * @param string|null $postal_code
  335.          *
  336.          * @return Shipping
  337.          */
  338.         public function setPostalCode($postal_code null)
  339.         {
  340.             $this->postal_code $postal_code;
  341.             return $this;
  342.         }
  343.         /**
  344.          * Get postal_code.
  345.          *
  346.          * @return string|null
  347.          */
  348.         public function getPostalCode()
  349.         {
  350.             return $this->postal_code;
  351.         }
  352.         /**
  353.          * Set addr01.
  354.          *
  355.          * @param string|null $addr01
  356.          *
  357.          * @return Shipping
  358.          */
  359.         public function setAddr01($addr01 null)
  360.         {
  361.             $this->addr01 $addr01;
  362.             return $this;
  363.         }
  364.         /**
  365.          * Get addr01.
  366.          *
  367.          * @return string|null
  368.          */
  369.         public function getAddr01()
  370.         {
  371.             return $this->addr01;
  372.         }
  373.         /**
  374.          * Set addr02.
  375.          *
  376.          * @param string|null $addr02
  377.          *
  378.          * @return Shipping
  379.          */
  380.         public function setAddr02($addr02 null)
  381.         {
  382.             $this->addr02 $addr02;
  383.             return $this;
  384.         }
  385.         /**
  386.          * Get addr02.
  387.          *
  388.          * @return string|null
  389.          */
  390.         public function getAddr02()
  391.         {
  392.             return $this->addr02;
  393.         }
  394.         /**
  395.          * Set shippingDeliveryName.
  396.          *
  397.          * @param string|null $shippingDeliveryName
  398.          *
  399.          * @return Shipping
  400.          */
  401.         public function setShippingDeliveryName($shippingDeliveryName null)
  402.         {
  403.             $this->shipping_delivery_name $shippingDeliveryName;
  404.             return $this;
  405.         }
  406.         /**
  407.          * Get shippingDeliveryName.
  408.          *
  409.          * @return string|null
  410.          */
  411.         public function getShippingDeliveryName()
  412.         {
  413.             return $this->shipping_delivery_name;
  414.         }
  415.         
  416.         /**
  417.          * Set createDate.
  418.          *
  419.          * @param \DateTime $createDate
  420.          *
  421.          * @return Shipping
  422.          */
  423.         public function setCreateDate($createDate)
  424.         {
  425.             $this->create_date $createDate;
  426.             return $this;
  427.         }
  428.         /**
  429.          * Get createDate.
  430.          *
  431.          * @return \DateTime
  432.          */
  433.         public function getCreateDate()
  434.         {
  435.             return $this->create_date;
  436.         }
  437.         /**
  438.          * Set updateDate.
  439.          *
  440.          * @param \DateTime $updateDate
  441.          *
  442.          * @return Shipping
  443.          */
  444.         public function setUpdateDate($updateDate)
  445.         {
  446.             $this->update_date $updateDate;
  447.             return $this;
  448.         }
  449.         /**
  450.          * Get updateDate.
  451.          *
  452.          * @return \DateTime
  453.          */
  454.         public function getUpdateDate()
  455.         {
  456.             return $this->update_date;
  457.         }
  458.         /**
  459.          * Add detail.
  460.          * 
  461.          * @param \Plugin\RegularPurchase\Entity\RegularPurchaseDetail $detail
  462.          * 
  463.          * @return Shipping
  464.          */
  465.         public function addDetail(RegularPurchaseDetail $detail)
  466.         {
  467.             if (!$this->details->contains($detail)) {
  468.                 $this->details[] = $detail;
  469.                 $detail->setRegularPurchase($this);
  470.             }
  471.             return $this;
  472.         }
  473.         /**
  474.          * Remove detail.
  475.          *
  476.          * @param \Plugin\RegularPurchase\Entity\RegularPurchaseDetail $detail
  477.          *
  478.          * @return Shipping
  479.          */
  480.         public function removeDetail(RegularPurchaseDetail $detail)
  481.         {
  482.             if ($this->details->contains($detail)) {
  483.                 $this->details->removeElement($detail);
  484.                 // set the owning side to null (unless already changed)
  485.                 if ($detail->getRegularPurchase() === $this) {
  486.                     $detail->setRegularPurchase(null);
  487.                 }
  488.             }
  489.             return $this;
  490.         }
  491.         /**
  492.          * Get details.
  493.          *
  494.          * @return \Doctrine\Common\Collections\Collection
  495.          */
  496.         public function getDetails()
  497.         {
  498.             return $this->details;
  499.         }
  500.         /**
  501.          * Set country.
  502.          *
  503.          * @param \Eccube\Entity\Master\Country|null $country
  504.          *
  505.          * @return Shipping
  506.          */
  507.         public function setCountry(?Country $country)
  508.         {
  509.             $this->Country $country;
  510.             return $this;
  511.         }
  512.         /**
  513.          * Get country.
  514.          *
  515.          * @return \Eccube\Entity\Master\Country|null
  516.          */
  517.         public function getCountry()
  518.         {
  519.             return $this->Country;
  520.         }
  521.         /**
  522.          * Set pref.
  523.          *
  524.          * @param \Eccube\Entity\Master\Pref|null $pref
  525.          *
  526.          * @return Shipping
  527.          */
  528.         public function setPref(Pref $pref null)
  529.         {
  530.             $this->Pref $pref;
  531.             return $this;
  532.         }
  533.         /**
  534.          * Get pref.
  535.          *
  536.          * @return \Eccube\Entity\Master\Pref|null
  537.          */
  538.         public function getPref()
  539.         {
  540.             return $this->Pref;
  541.         }
  542.         /**
  543.          * Set delivery.
  544.          *
  545.          * @param \Eccube\Entity\Delivery|null $delivery
  546.          *
  547.          * @return Shipping
  548.          */
  549.         public function setDelivery(Delivery $delivery null)
  550.         {
  551.             $this->Delivery $delivery;
  552.             return $this;
  553.         }
  554.         /**
  555.          * Get delivery.
  556.          *
  557.          * @return \Eccube\Entity\Delivery|null
  558.          */
  559.         public function getDelivery()
  560.         {
  561.             return $this->Delivery;
  562.         }
  563.         /**
  564.          * Set regularPurchase.
  565.          * 
  566.          * @param \Plugin\RegularPurchase\Entity\RegularPurchase $regularPurchase
  567.          *  
  568.          * @return Shipping
  569.          */
  570.         public function setRegularPurchase(RegularPurchase $regularPurchase null)
  571.         {
  572.             $this->regularPurchase $regularPurchase;
  573.             return $this;
  574.         }
  575.         /**
  576.          * Get regularPurchase.
  577.          *
  578.          * @return \Plugin\RegularPurchase\Entity\RegularPurchase|null
  579.          */
  580.         public function getRegularPurchase()
  581.         {
  582.             return $this->regularPurchase;
  583.         }
  584.         /**
  585.          * Set note.
  586.          *
  587.          * @param string|null $note
  588.          *
  589.          * @return Shipping
  590.          */
  591.         public function setNote($note null)
  592.         {
  593.             $this->note $note;
  594.             return $this;
  595.         }
  596.         /**
  597.          * Get note.
  598.          *
  599.          * @return string|null
  600.          */
  601.         public function getNote()
  602.         {
  603.             return $this->note;
  604.         }
  605.         public function setDeliveryTime($DeliveryTime null)
  606.         {
  607.             $this->DeliveryTime $DeliveryTime;
  608.             return $this;
  609.         }
  610.         public function getDeliveryTime()
  611.         {
  612.             return $this->DeliveryTime;
  613.         }
  614.         /**
  615.          * Set creator.
  616.          *
  617.          * @param \Eccube\Entity\Member|null $creator
  618.          *
  619.          * @return Shipping
  620.          */
  621.         public function setCreator(Member $creator null)
  622.         {
  623.             $this->Creator $creator;
  624.             return $this;
  625.         }
  626.         /**
  627.          * Get creator.
  628.          *
  629.          * @return \Eccube\Entity\Member|null
  630.          */
  631.         public function getCreator()
  632.         {
  633.             return $this->Creator;
  634.         }
  635.         public function getTimeId2()
  636.         {
  637.             $arrs = [
  638.                 "午前中" => 1,
  639.                 "12時~14時" => 2,
  640.                 "14時~16時" => 3,
  641.                 "16時~18時" => 4,
  642.                 "18時~20時" => 5,
  643.                 "19時~21時" => 6
  644.             ];
  645.             $time_id2 = isset($arrs[$this->shipping_delivery_time]) ? $arrs[$this->shipping_delivery_time] : 9;
  646.             return $time_id2;
  647.         }
  648.         /**
  649.          * Set shipping.
  650.          *
  651.          * @param \Eccube\Entity\Shipping|null $shipping
  652.          *
  653.          * @return Shipping
  654.          */
  655.         public function setShipping(Shipping $shipping null)
  656.         {
  657.             $this->Shipping $shipping;
  658.             return $this;
  659.         }
  660.         /**
  661.          * Get shipping.
  662.          *
  663.          * @return \Eccube\Entity\Shipping|null
  664.          */
  665.         public function getShipping()
  666.         {
  667.             return $this->Shipping;
  668.         }
  669.         /**
  670.          * @var \Doctrine\Common\Collections\Collection
  671.          *
  672.          * @ORM\OneToMany(targetEntity="Eccube\Entity\Shipping", mappedBy="RegularPurchaseShipping", cascade={"persist"})
  673.          */
  674.         private $Shippings;
  675.         public function addShipping(Shipping $shipping)
  676.         {
  677.             if (!$this->Shippings->contains($shipping)) {
  678.                 $this->Shippings[] = $shipping;
  679.                 $shipping->setRegularPurchaseShipping($this);
  680.             }
  681.             return $this;
  682.         }
  683.         public function removeShipping(Shipping $shipping)
  684.         {
  685.             if ($this->Shippings->contains($shipping)) {
  686.                 $this->Shippings->removeElement($shipping);
  687.                 // set the owning side to null (unless already changed)
  688.                 if ($shipping->getRegularPurchaseShipping() === $this) {
  689.                     $shipping->setRegularPurchaseShipping(null);
  690.                 }
  691.             }
  692.             return $this;
  693.         }
  694.         public function getShippings()
  695.         {
  696.             return $this->Shippings;
  697.         }
  698.     }
  699. }