src/Eccube/Entity/CustomerAddress.php line 28

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 Eccube\Entity;
  13. use Doctrine\ORM\Mapping as ORM;
  14. if (!class_exists('\Eccube\Entity\CustomerAddress')) {
  15.     /**
  16.      * CustomerAddress
  17.      *
  18.      * @ORM\Table(name="dtb_customer_address")
  19.      * @ORM\InheritanceType("SINGLE_TABLE")
  20.      * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
  21.      * @ORM\HasLifecycleCallbacks()
  22.      * @ORM\Entity(repositoryClass="Eccube\Repository\CustomerAddressRepository")
  23.      */
  24.     class CustomerAddress extends AbstractEntity
  25.     {
  26.         /**
  27.          * getShippingMultipleDefaultName
  28.          *
  29.          * @return string
  30.          */
  31.         public function getShippingMultipleDefaultName()
  32.         {
  33.             return $this->getName01().' '.$this->getPref()->getName().' '.$this->getAddr01().' '.$this->getAddr02();
  34.         }
  35.         /**
  36.          * Set from customer.
  37.          *
  38.          * @param \Eccube\Entity\Customer $Customer
  39.          *
  40.          * @return \Eccube\Entity\CustomerAddress
  41.          */
  42.         public function setFromCustomer(Customer $Customer)
  43.         {
  44.             $this
  45.             ->setCustomer($Customer)
  46.             ->setName01($Customer->getName01())
  47.             ->setName02($Customer->getName02())
  48.             ->setKana01($Customer->getKana01())
  49.             ->setKana02($Customer->getKana02())
  50.             ->setCompanyName($Customer->getCompanyName())
  51.             ->setPhoneNumber($Customer->getPhoneNumber())
  52.             ->setPostalCode($Customer->getPostalCode())
  53.             ->setPref($Customer->getPref())
  54.             ->setAddr01($Customer->getAddr01())
  55.             ->setAddr02($Customer->getAddr02());
  56.             return $this;
  57.         }
  58.         /**
  59.          * Set from Shipping.
  60.          *
  61.          * @param \Eccube\Entity\Shipping $Shipping
  62.          *
  63.          * @return \Eccube\Entity\CustomerAddress
  64.          */
  65.         public function setFromShipping(Shipping $Shipping)
  66.         {
  67.             $this
  68.             ->setName01($Shipping->getName01())
  69.             ->setName02($Shipping->getName02())
  70.             ->setKana01($Shipping->getKana01())
  71.             ->setKana02($Shipping->getKana02())
  72.             ->setCompanyName($Shipping->getCompanyName())
  73.             ->setPhoneNumber($Shipping->getPhoneNumber())
  74.             ->setPostalCode($Shipping->getPostalCode())
  75.             ->setPref($Shipping->getPref())
  76.             ->setAddr01($Shipping->getAddr01())
  77.             ->setAddr02($Shipping->getAddr02());
  78.             return $this;
  79.         }
  80.         /**
  81.          * @var int
  82.          *
  83.          * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  84.          * @ORM\Id
  85.          * @ORM\GeneratedValue(strategy="IDENTITY")
  86.          */
  87.         private $id;
  88.         /**
  89.          * @var string|null
  90.          *
  91.          * @ORM\Column(name="name01", type="string", length=255)
  92.          */
  93.         private $name01;
  94.         /**
  95.          * @var string|null
  96.          *
  97.          * @ORM\Column(name="name02", type="string", length=255)
  98.          */
  99.         private $name02;
  100.         /**
  101.          * @var string|null
  102.          *
  103.          * @ORM\Column(name="kana01", type="string", length=255, nullable=true)
  104.          */
  105.         private $kana01;
  106.         /**
  107.          * @var string|null
  108.          *
  109.          * @ORM\Column(name="kana02", type="string", length=255, nullable=true)
  110.          */
  111.         private $kana02;
  112.         /**
  113.          * @var string|null
  114.          *
  115.          * @ORM\Column(name="company_name", type="string", length=255, nullable=true)
  116.          */
  117.         private $company_name;
  118.         /**
  119.          * @var string|null
  120.          *
  121.          * @ORM\Column(name="postal_code", type="string", length=8, nullable=true)
  122.          */
  123.         private $postal_code;
  124.         /**
  125.          * @var string|null
  126.          *
  127.          * @ORM\Column(name="addr01", type="string", length=255, nullable=true)
  128.          */
  129.         private $addr01;
  130.         /**
  131.          * @var string|null
  132.          *
  133.          * @ORM\Column(name="addr02", type="string", length=255, nullable=true)
  134.          */
  135.         private $addr02;
  136.         /**
  137.          * @var string|null
  138.          *
  139.          * @ORM\Column(name="phone_number", type="string", length=14, nullable=true)
  140.          */
  141.         private $phone_number;
  142.         /**
  143.          * @var \DateTime
  144.          *
  145.          * @ORM\Column(name="create_date", type="datetimetz")
  146.          */
  147.         private $create_date;
  148.         /**
  149.          * @var \DateTime
  150.          *
  151.          * @ORM\Column(name="update_date", type="datetimetz")
  152.          */
  153.         private $update_date;
  154.         /**
  155.          * @var \Eccube\Entity\Customer
  156.          *
  157.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Customer", inversedBy="CustomerAddresses")
  158.          * @ORM\JoinColumns({
  159.          *   @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
  160.          * })
  161.          */
  162.         private $Customer;
  163.         /**
  164.          * @var \Eccube\Entity\Master\Country
  165.          *
  166.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Country")
  167.          * @ORM\JoinColumns({
  168.          *   @ORM\JoinColumn(name="country_id", referencedColumnName="id")
  169.          * })
  170.          */
  171.         private $Country;
  172.         /**
  173.          * @var \Eccube\Entity\Master\Pref
  174.          *
  175.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Pref")
  176.          * @ORM\JoinColumns({
  177.          *   @ORM\JoinColumn(name="pref_id", referencedColumnName="id")
  178.          * })
  179.          */
  180.         private $Pref;
  181.         /**
  182.          * Get id.
  183.          *
  184.          * @return int
  185.          */
  186.         public function getId()
  187.         {
  188.             return $this->id;
  189.         }
  190.         /**
  191.          * Set name01.
  192.          *
  193.          * @param string|null $name01
  194.          *
  195.          * @return CustomerAddress
  196.          */
  197.         public function setName01($name01 null)
  198.         {
  199.             $this->name01 $name01;
  200.             return $this;
  201.         }
  202.         /**
  203.          * Get name01.
  204.          *
  205.          * @return string|null
  206.          */
  207.         public function getName01()
  208.         {
  209.             return $this->name01;
  210.         }
  211.         /**
  212.          * Set name02.
  213.          *
  214.          * @param string|null $name02
  215.          *
  216.          * @return CustomerAddress
  217.          */
  218.         public function setName02($name02 null)
  219.         {
  220.             $this->name02 $name02;
  221.             return $this;
  222.         }
  223.         /**
  224.          * Get name02.
  225.          *
  226.          * @return string|null
  227.          */
  228.         public function getName02()
  229.         {
  230.             return $this->name02;
  231.         }
  232.         /**
  233.          * Set kana01.
  234.          *
  235.          * @param string|null $kana01
  236.          *
  237.          * @return CustomerAddress
  238.          */
  239.         public function setKana01($kana01 null)
  240.         {
  241.             $this->kana01 $kana01;
  242.             return $this;
  243.         }
  244.         /**
  245.          * Get kana01.
  246.          *
  247.          * @return string|null
  248.          */
  249.         public function getKana01()
  250.         {
  251.             return $this->kana01;
  252.         }
  253.         /**
  254.          * Set kana02.
  255.          *
  256.          * @param string|null $kana02
  257.          *
  258.          * @return CustomerAddress
  259.          */
  260.         public function setKana02($kana02 null)
  261.         {
  262.             $this->kana02 $kana02;
  263.             return $this;
  264.         }
  265.         /**
  266.          * Get kana02.
  267.          *
  268.          * @return string|null
  269.          */
  270.         public function getKana02()
  271.         {
  272.             return $this->kana02;
  273.         }
  274.         /**
  275.          * Set companyName.
  276.          *
  277.          * @param string|null $companyName
  278.          *
  279.          * @return CustomerAddress
  280.          */
  281.         public function setCompanyName($companyName null)
  282.         {
  283.             $this->company_name $companyName;
  284.             return $this;
  285.         }
  286.         /**
  287.          * Get companyName.
  288.          *
  289.          * @return string|null
  290.          */
  291.         public function getCompanyName()
  292.         {
  293.             return $this->company_name;
  294.         }
  295.         /**
  296.          * Set postal_code.
  297.          *
  298.          * @param string|null $postal_code
  299.          *
  300.          * @return CustomerAddress
  301.          */
  302.         public function setPostalCode($postal_code null)
  303.         {
  304.             $this->postal_code $postal_code;
  305.             return $this;
  306.         }
  307.         /**
  308.          * Get postal_code.
  309.          *
  310.          * @return string|null
  311.          */
  312.         public function getPostalCode()
  313.         {
  314.             return $this->postal_code;
  315.         }
  316.         /**
  317.          * Set addr01.
  318.          *
  319.          * @param string|null $addr01
  320.          *
  321.          * @return CustomerAddress
  322.          */
  323.         public function setAddr01($addr01 null)
  324.         {
  325.             $this->addr01 $addr01;
  326.             return $this;
  327.         }
  328.         /**
  329.          * Get addr01.
  330.          *
  331.          * @return string|null
  332.          */
  333.         public function getAddr01()
  334.         {
  335.             return $this->addr01;
  336.         }
  337.         /**
  338.          * Set addr02.
  339.          *
  340.          * @param string|null $addr02
  341.          *
  342.          * @return CustomerAddress
  343.          */
  344.         public function setAddr02($addr02 null)
  345.         {
  346.             $this->addr02 $addr02;
  347.             return $this;
  348.         }
  349.         /**
  350.          * Get addr02.
  351.          *
  352.          * @return string|null
  353.          */
  354.         public function getAddr02()
  355.         {
  356.             return $this->addr02;
  357.         }
  358.         /**
  359.          * Set phone_number.
  360.          *
  361.          * @param string|null $phone_number
  362.          *
  363.          * @return CustomerAddress
  364.          */
  365.         public function setPhoneNumber($phone_number null)
  366.         {
  367.             $this->phone_number $phone_number;
  368.             return $this;
  369.         }
  370.         /**
  371.          * Get phone_number.
  372.          *
  373.          * @return string|null
  374.          */
  375.         public function getPhoneNumber()
  376.         {
  377.             return $this->phone_number;
  378.         }
  379.         /**
  380.          * Set createDate.
  381.          *
  382.          * @param \DateTime $createDate
  383.          *
  384.          * @return CustomerAddress
  385.          */
  386.         public function setCreateDate($createDate)
  387.         {
  388.             $this->create_date $createDate;
  389.             return $this;
  390.         }
  391.         /**
  392.          * Get createDate.
  393.          *
  394.          * @return \DateTime
  395.          */
  396.         public function getCreateDate()
  397.         {
  398.             return $this->create_date;
  399.         }
  400.         /**
  401.          * Set updateDate.
  402.          *
  403.          * @param \DateTime $updateDate
  404.          *
  405.          * @return CustomerAddress
  406.          */
  407.         public function setUpdateDate($updateDate)
  408.         {
  409.             $this->update_date $updateDate;
  410.             return $this;
  411.         }
  412.         /**
  413.          * Get updateDate.
  414.          *
  415.          * @return \DateTime
  416.          */
  417.         public function getUpdateDate()
  418.         {
  419.             return $this->update_date;
  420.         }
  421.         /**
  422.          * Set customer.
  423.          *
  424.          * @param \Eccube\Entity\Customer|null $customer
  425.          *
  426.          * @return CustomerAddress
  427.          */
  428.         public function setCustomer(Customer $customer null)
  429.         {
  430.             $this->Customer $customer;
  431.             return $this;
  432.         }
  433.         /**
  434.          * Get customer.
  435.          *
  436.          * @return \Eccube\Entity\Customer|null
  437.          */
  438.         public function getCustomer()
  439.         {
  440.             return $this->Customer;
  441.         }
  442.         /**
  443.          * Set country.
  444.          *
  445.          * @param \Eccube\Entity\Master\Country|null $country
  446.          *
  447.          * @return CustomerAddress
  448.          */
  449.         public function setCountry(Master\Country $country null)
  450.         {
  451.             $this->Country $country;
  452.             return $this;
  453.         }
  454.         /**
  455.          * Get country.
  456.          *
  457.          * @return \Eccube\Entity\Master\Country|null
  458.          */
  459.         public function getCountry()
  460.         {
  461.             return $this->Country;
  462.         }
  463.         /**
  464.          * Set pref.
  465.          *
  466.          * @param \Eccube\Entity\Master\Pref|null $pref
  467.          *
  468.          * @return CustomerAddress
  469.          */
  470.         public function setPref(Master\Pref $pref null)
  471.         {
  472.             $this->Pref $pref;
  473.             return $this;
  474.         }
  475.         /**
  476.          * Get pref.
  477.          *
  478.          * @return \Eccube\Entity\Master\Pref|null
  479.          */
  480.         public function getPref()
  481.         {
  482.             return $this->Pref;
  483.         }
  484.     }
  485. }