src/Eccube/Entity/Customer.php line 22

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. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  15. use Symfony\Component\Security\Core\User\UserInterface;
  16. use Symfony\Component\Validator\Constraints as Assert;
  17. use Symfony\Component\Validator\Mapping\ClassMetadata;
  18. if (!class_exists('\Eccube\Entity\Customer')) {
  19.     /**
  20.      * Customer
  21.      *
  22.      * @ORM\Table(name="dtb_customer", uniqueConstraints={@ORM\UniqueConstraint(name="secret_key", columns={"secret_key"})}, indexes={@ORM\Index(name="dtb_customer_buy_times_idx", columns={"buy_times"}), @ORM\Index(name="dtb_customer_buy_total_idx", columns={"buy_total"}), @ORM\Index(name="dtb_customer_create_date_idx", columns={"create_date"}), @ORM\Index(name="dtb_customer_update_date_idx", columns={"update_date"}), @ORM\Index(name="dtb_customer_last_buy_date_idx", columns={"last_buy_date"}), @ORM\Index(name="dtb_customer_email_idx", columns={"email"})})
  23.      * @ORM\InheritanceType("SINGLE_TABLE")
  24.      * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
  25.      * @ORM\HasLifecycleCallbacks()
  26.      * @ORM\Entity(repositoryClass="Eccube\Repository\CustomerRepository")
  27.      */
  28.     class Customer extends \Eccube\Entity\AbstractEntity implements UserInterface, \Serializable
  29.     {
  30.         /**
  31.          * @var int
  32.          *
  33.          * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  34.          * @ORM\Id
  35.          * @ORM\GeneratedValue(strategy="IDENTITY")
  36.          */
  37.         private $id;
  38.         /**
  39.          * @var string
  40.          *
  41.          * @ORM\Column(name="name01", type="string", length=255)
  42.          */
  43.         private $name01;
  44.         /**
  45.          * @var string
  46.          *
  47.          * @ORM\Column(name="name02", type="string", length=255)
  48.          */
  49.         private $name02;
  50.         /**
  51.          * @var string|null
  52.          *
  53.          * @ORM\Column(name="kana01", type="string", length=255, nullable=true)
  54.          */
  55.         private $kana01;
  56.         /**
  57.          * @var string|null
  58.          *
  59.          * @ORM\Column(name="kana02", type="string", length=255, nullable=true)
  60.          */
  61.         private $kana02;
  62.         /**
  63.          * @var string|null
  64.          *
  65.          * @ORM\Column(name="company_name", type="string", length=255, nullable=true)
  66.          */
  67.         private $company_name;
  68.         /**
  69.          * @var string|null
  70.          *
  71.          * @ORM\Column(name="postal_code", type="string", length=8, nullable=true)
  72.          */
  73.         private $postal_code;
  74.         /**
  75.          * @var string|null
  76.          *
  77.          * @ORM\Column(name="addr01", type="string", length=255, nullable=true)
  78.          */
  79.         private $addr01;
  80.         /**
  81.          * @var string|null
  82.          *
  83.          * @ORM\Column(name="addr02", type="string", length=255, nullable=true)
  84.          */
  85.         private $addr02;
  86.         /**
  87.          * @var string
  88.          *
  89.          * @ORM\Column(name="email", type="string", length=255)
  90.          */
  91.         private $email;
  92.         /**
  93.          * @var string|null
  94.          *
  95.          * @ORM\Column(name="phone_number", type="string", length=14, nullable=true)
  96.          */
  97.         private $phone_number;
  98.         /**
  99.          * @var \DateTime|null
  100.          *
  101.          * @ORM\Column(name="birth", type="datetimetz", nullable=true)
  102.          */
  103.         private $birth;
  104.         /**
  105.          * @Assert\NotBlank()
  106.          * @Assert\Length(max=4096)
  107.          */
  108.         private $plain_password;
  109.         /**
  110.          * @var string|null
  111.          *
  112.          * @ORM\Column(name="password", type="string", length=255)
  113.          */
  114.         private $password;
  115.         /**
  116.          * @var string|null
  117.          *
  118.          * @ORM\Column(name="salt", type="string", length=255, nullable=true)
  119.          */
  120.         private $salt;
  121.         /**
  122.          * @var string
  123.          *
  124.          * @ORM\Column(name="secret_key", type="string", length=255)
  125.          */
  126.         private $secret_key;
  127.         /**
  128.          * @var \DateTime|null
  129.          *
  130.          * @ORM\Column(name="first_buy_date", type="datetimetz", nullable=true)
  131.          */
  132.         private $first_buy_date;
  133.         /**
  134.          * @var \DateTime|null
  135.          *
  136.          * @ORM\Column(name="last_buy_date", type="datetimetz", nullable=true)
  137.          */
  138.         private $last_buy_date;
  139.         /**
  140.          * @var string|null
  141.          *
  142.          * @ORM\Column(name="buy_times", type="decimal", precision=10, scale=0, nullable=true, options={"unsigned":true,"default":0})
  143.          */
  144.         private $buy_times 0;
  145.         /**
  146.          * @var string|null
  147.          *
  148.          * @ORM\Column(name="buy_total", type="decimal", precision=12, scale=2, nullable=true, options={"unsigned":true,"default":0})
  149.          */
  150.         private $buy_total 0;
  151.         /**
  152.          * @var string|null
  153.          *
  154.          * @ORM\Column(name="note", type="string", length=4000, nullable=true)
  155.          */
  156.         private $note;
  157.         /**
  158.          * @var string|null
  159.          *
  160.          * @ORM\Column(name="reset_key", type="string", length=255, nullable=true)
  161.          */
  162.         private $reset_key;
  163.         /**
  164.          * @var \DateTime|null
  165.          *
  166.          * @ORM\Column(name="reset_expire", type="datetimetz", nullable=true)
  167.          */
  168.         private $reset_expire;
  169.         /**
  170.          * @var string
  171.          *
  172.          * @ORM\Column(name="point", type="decimal", precision=12, scale=0, options={"unsigned":false,"default":0})
  173.          */
  174.         private $point '0';
  175.         /**
  176.          * @var \DateTime
  177.          *
  178.          * @ORM\Column(name="create_date", type="datetimetz")
  179.          */
  180.         private $create_date;
  181.         /**
  182.          * @var \DateTime
  183.          *
  184.          * @ORM\Column(name="update_date", type="datetimetz")
  185.          */
  186.         private $update_date;
  187.         /**
  188.          * @var \Doctrine\Common\Collections\Collection
  189.          *
  190.          * @ORM\OneToMany(targetEntity="Eccube\Entity\CustomerFavoriteProduct", mappedBy="Customer", cascade={"remove"})
  191.          */
  192.         private $CustomerFavoriteProducts;
  193.         /**
  194.          * @var \Doctrine\Common\Collections\Collection
  195.          *
  196.          * @ORM\OneToMany(targetEntity="Eccube\Entity\CustomerAddress", mappedBy="Customer", cascade={"remove"})
  197.          * @ORM\OrderBy({
  198.          *     "id"="ASC"
  199.          * })
  200.          */
  201.         private $CustomerAddresses;
  202.         /**
  203.          * @var \Doctrine\Common\Collections\Collection
  204.          *
  205.          * @ORM\OneToMany(targetEntity="Eccube\Entity\Order", mappedBy="Customer")
  206.          */
  207.         private $Orders;
  208.         /**
  209.          * @var \Eccube\Entity\Master\CustomerStatus
  210.          *
  211.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\CustomerStatus")
  212.          * @ORM\JoinColumns({
  213.          *   @ORM\JoinColumn(name="customer_status_id", referencedColumnName="id")
  214.          * })
  215.          */
  216.         private $Status;
  217.         /**
  218.          * @var \Eccube\Entity\Master\Sex
  219.          *
  220.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Sex")
  221.          * @ORM\JoinColumns({
  222.          *   @ORM\JoinColumn(name="sex_id", referencedColumnName="id")
  223.          * })
  224.          */
  225.         private $Sex;
  226.         /**
  227.          * @var \Eccube\Entity\Master\Job
  228.          *
  229.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Job")
  230.          * @ORM\JoinColumns({
  231.          *   @ORM\JoinColumn(name="job_id", referencedColumnName="id")
  232.          * })
  233.          */
  234.         private $Job;
  235.         /**
  236.          * @var \Eccube\Entity\Master\Country
  237.          *
  238.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Country")
  239.          * @ORM\JoinColumns({
  240.          *   @ORM\JoinColumn(name="country_id", referencedColumnName="id")
  241.          * })
  242.          */
  243.         private $Country;
  244.         /**
  245.          * @var \Eccube\Entity\Master\Pref
  246.          *
  247.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Pref")
  248.          * @ORM\JoinColumns({
  249.          *   @ORM\JoinColumn(name="pref_id", referencedColumnName="id")
  250.          * })
  251.          */
  252.         private $Pref;
  253.         /**
  254.          * Constructor
  255.          */
  256.         public function __construct()
  257.         {
  258.             $this->CustomerFavoriteProducts = new \Doctrine\Common\Collections\ArrayCollection();
  259.             $this->CustomerAddresses = new \Doctrine\Common\Collections\ArrayCollection();
  260.             $this->Orders = new \Doctrine\Common\Collections\ArrayCollection();
  261.             $this->setBuyTimes(0);
  262.             $this->setBuyTotal(0);
  263.         }
  264.         /**
  265.          * @return string
  266.          */
  267.         public function __toString()
  268.         {
  269.             return (string) ($this->getName01().' '.$this->getName02());
  270.         }
  271.         /**
  272.          * {@inheritdoc}
  273.          */
  274.         public function getRoles()
  275.         {
  276.             return ['ROLE_USER'];
  277.         }
  278.         /**
  279.          * {@inheritdoc}
  280.          */
  281.         public function getUsername()
  282.         {
  283.             return $this->email;
  284.         }
  285.         /**
  286.          * {@inheritdoc}
  287.          */
  288.         public function eraseCredentials()
  289.         {
  290.         }
  291.         // TODO: できればFormTypeで行いたい
  292.         public static function loadValidatorMetadata(ClassMetadata $metadata)
  293.         {
  294.             $metadata->addConstraint(new UniqueEntity([
  295.                 'fields' => 'email',
  296.                 'message' => 'form_error.customer_already_exists',
  297.                 'repositoryMethod' => 'getNonWithdrawingCustomers',
  298.             ]));
  299.         }
  300.         /**
  301.          * Get id.
  302.          *
  303.          * @return int
  304.          */
  305.         public function getId()
  306.         {
  307.             return $this->id;
  308.         }
  309.         /**
  310.          * Set name01.
  311.          *
  312.          * @param string $name01
  313.          *
  314.          * @return Customer
  315.          */
  316.         public function setName01($name01)
  317.         {
  318.             $this->name01 $name01;
  319.             return $this;
  320.         }
  321.         /**
  322.          * Get name01.
  323.          *
  324.          * @return string
  325.          */
  326.         public function getName01()
  327.         {
  328.             return $this->name01;
  329.         }
  330.         /**
  331.          * Set name02.
  332.          *
  333.          * @param string $name02
  334.          *
  335.          * @return Customer
  336.          */
  337.         public function setName02($name02)
  338.         {
  339.             $this->name02 $name02;
  340.             return $this;
  341.         }
  342.         /**
  343.          * Get name02.
  344.          *
  345.          * @return string
  346.          */
  347.         public function getName02()
  348.         {
  349.             return $this->name02;
  350.         }
  351.         /**
  352.          * Set kana01.
  353.          *
  354.          * @param string|null $kana01
  355.          *
  356.          * @return Customer
  357.          */
  358.         public function setKana01($kana01 null)
  359.         {
  360.             $this->kana01 $kana01;
  361.             return $this;
  362.         }
  363.         /**
  364.          * Get kana01.
  365.          *
  366.          * @return string|null
  367.          */
  368.         public function getKana01()
  369.         {
  370.             return $this->kana01;
  371.         }
  372.         /**
  373.          * Set kana02.
  374.          *
  375.          * @param string|null $kana02
  376.          *
  377.          * @return Customer
  378.          */
  379.         public function setKana02($kana02 null)
  380.         {
  381.             $this->kana02 $kana02;
  382.             return $this;
  383.         }
  384.         /**
  385.          * Get kana02.
  386.          *
  387.          * @return string|null
  388.          */
  389.         public function getKana02()
  390.         {
  391.             return $this->kana02;
  392.         }
  393.         /**
  394.          * Set companyName.
  395.          *
  396.          * @param string|null $companyName
  397.          *
  398.          * @return Customer
  399.          */
  400.         public function setCompanyName($companyName null)
  401.         {
  402.             $this->company_name $companyName;
  403.             return $this;
  404.         }
  405.         /**
  406.          * Get companyName.
  407.          *
  408.          * @return string|null
  409.          */
  410.         public function getCompanyName()
  411.         {
  412.             return $this->company_name;
  413.         }
  414.         /**
  415.          * Set postal_code.
  416.          *
  417.          * @param string|null $postal_code
  418.          *
  419.          * @return Customer
  420.          */
  421.         public function setPostalCode($postal_code null)
  422.         {
  423.             $this->postal_code $postal_code;
  424.             return $this;
  425.         }
  426.         /**
  427.          * Get postal_code.
  428.          *
  429.          * @return string|null
  430.          */
  431.         public function getPostalCode()
  432.         {
  433.             return $this->postal_code;
  434.         }
  435.         /**
  436.          * Set addr01.
  437.          *
  438.          * @param string|null $addr01
  439.          *
  440.          * @return Customer
  441.          */
  442.         public function setAddr01($addr01 null)
  443.         {
  444.             $this->addr01 $addr01;
  445.             return $this;
  446.         }
  447.         /**
  448.          * Get addr01.
  449.          *
  450.          * @return string|null
  451.          */
  452.         public function getAddr01()
  453.         {
  454.             return $this->addr01;
  455.         }
  456.         /**
  457.          * Set addr02.
  458.          *
  459.          * @param string|null $addr02
  460.          *
  461.          * @return Customer
  462.          */
  463.         public function setAddr02($addr02 null)
  464.         {
  465.             $this->addr02 $addr02;
  466.             return $this;
  467.         }
  468.         /**
  469.          * Get addr02.
  470.          *
  471.          * @return string|null
  472.          */
  473.         public function getAddr02()
  474.         {
  475.             return $this->addr02;
  476.         }
  477.         /**
  478.          * Set email.
  479.          *
  480.          * @param string $email
  481.          *
  482.          * @return Customer
  483.          */
  484.         public function setEmail($email)
  485.         {
  486.             $this->email $email;
  487.             return $this;
  488.         }
  489.         /**
  490.          * Get email.
  491.          *
  492.          * @return string
  493.          */
  494.         public function getEmail()
  495.         {
  496.             return $this->email;
  497.         }
  498.         /**
  499.          * Set phone_number.
  500.          *
  501.          * @param string|null $phone_number
  502.          *
  503.          * @return Customer
  504.          */
  505.         public function setPhoneNumber($phone_number null)
  506.         {
  507.             $this->phone_number $phone_number;
  508.             return $this;
  509.         }
  510.         /**
  511.          * Get phone_number.
  512.          *
  513.          * @return string|null
  514.          */
  515.         public function getPhoneNumber()
  516.         {
  517.             return $this->phone_number;
  518.         }
  519.         /**
  520.          * Set birth.
  521.          *
  522.          * @param \DateTime|null $birth
  523.          *
  524.          * @return Customer
  525.          */
  526.         public function setBirth($birth null)
  527.         {
  528.             $this->birth $birth;
  529.             return $this;
  530.         }
  531.         /**
  532.          * Get birth.
  533.          *
  534.          * @return \DateTime|null
  535.          */
  536.         public function getBirth()
  537.         {
  538.             return $this->birth;
  539.         }
  540.         /**
  541.          * @param string|null $password
  542.          *
  543.          * @return $this
  544.          */
  545.         public function setPlainPassword(?string $password): self
  546.         {
  547.             $this->plain_password $password;
  548.             return $this;
  549.         }
  550.         /**
  551.          * @return string|null
  552.          */
  553.         public function getPlainPassword(): ?string
  554.         {
  555.             return $this->plain_password;
  556.         }
  557.         /**
  558.          * Set password.
  559.          *
  560.          * @param string|null $password
  561.          *
  562.          * @return Customer
  563.          */
  564.         public function setPassword($password null)
  565.         {
  566.             $this->password $password;
  567.             return $this;
  568.         }
  569.         /**
  570.          * Get password.
  571.          *
  572.          * @return string|null
  573.          */
  574.         public function getPassword()
  575.         {
  576.             return $this->password;
  577.         }
  578.         /**
  579.          * Set salt.
  580.          *
  581.          * @param string|null $salt
  582.          *
  583.          * @return Customer
  584.          */
  585.         public function setSalt($salt null)
  586.         {
  587.             $this->salt $salt;
  588.             return $this;
  589.         }
  590.         /**
  591.          * Get salt.
  592.          *
  593.          * @return string|null
  594.          */
  595.         public function getSalt()
  596.         {
  597.             return $this->salt;
  598.         }
  599.         /**
  600.          * Set secretKey.
  601.          *
  602.          * @param string $secretKey
  603.          *
  604.          * @return Customer
  605.          */
  606.         public function setSecretKey($secretKey)
  607.         {
  608.             $this->secret_key $secretKey;
  609.             return $this;
  610.         }
  611.         /**
  612.          * Get secretKey.
  613.          *
  614.          * @return string
  615.          */
  616.         public function getSecretKey()
  617.         {
  618.             return $this->secret_key;
  619.         }
  620.         /**
  621.          * Set firstBuyDate.
  622.          *
  623.          * @param \DateTime|null $firstBuyDate
  624.          *
  625.          * @return Customer
  626.          */
  627.         public function setFirstBuyDate($firstBuyDate null)
  628.         {
  629.             $this->first_buy_date $firstBuyDate;
  630.             return $this;
  631.         }
  632.         /**
  633.          * Get firstBuyDate.
  634.          *
  635.          * @return \DateTime|null
  636.          */
  637.         public function getFirstBuyDate()
  638.         {
  639.             return $this->first_buy_date;
  640.         }
  641.         /**
  642.          * Set lastBuyDate.
  643.          *
  644.          * @param \DateTime|null $lastBuyDate
  645.          *
  646.          * @return Customer
  647.          */
  648.         public function setLastBuyDate($lastBuyDate null)
  649.         {
  650.             $this->last_buy_date $lastBuyDate;
  651.             return $this;
  652.         }
  653.         /**
  654.          * Get lastBuyDate.
  655.          *
  656.          * @return \DateTime|null
  657.          */
  658.         public function getLastBuyDate()
  659.         {
  660.             return $this->last_buy_date;
  661.         }
  662.         /**
  663.          * Set buyTimes.
  664.          *
  665.          * @param string|null $buyTimes
  666.          *
  667.          * @return Customer
  668.          */
  669.         public function setBuyTimes($buyTimes null)
  670.         {
  671.             $this->buy_times $buyTimes;
  672.             return $this;
  673.         }
  674.         /**
  675.          * Get buyTimes.
  676.          *
  677.          * @return string|null
  678.          */
  679.         public function getBuyTimes()
  680.         {
  681.             return $this->buy_times;
  682.         }
  683.         /**
  684.          * Set buyTotal.
  685.          *
  686.          * @param string|null $buyTotal
  687.          *
  688.          * @return Customer
  689.          */
  690.         public function setBuyTotal($buyTotal null)
  691.         {
  692.             $this->buy_total $buyTotal;
  693.             return $this;
  694.         }
  695.         /**
  696.          * Get buyTotal.
  697.          *
  698.          * @return string|null
  699.          */
  700.         public function getBuyTotal()
  701.         {
  702.             return $this->buy_total;
  703.         }
  704.         /**
  705.          * Set note.
  706.          *
  707.          * @param string|null $note
  708.          *
  709.          * @return Customer
  710.          */
  711.         public function setNote($note null)
  712.         {
  713.             $this->note $note;
  714.             return $this;
  715.         }
  716.         /**
  717.          * Get note.
  718.          *
  719.          * @return string|null
  720.          */
  721.         public function getNote()
  722.         {
  723.             return $this->note;
  724.         }
  725.         /**
  726.          * Set resetKey.
  727.          *
  728.          * @param string|null $resetKey
  729.          *
  730.          * @return Customer
  731.          */
  732.         public function setResetKey($resetKey null)
  733.         {
  734.             $this->reset_key $resetKey;
  735.             return $this;
  736.         }
  737.         /**
  738.          * Get resetKey.
  739.          *
  740.          * @return string|null
  741.          */
  742.         public function getResetKey()
  743.         {
  744.             return $this->reset_key;
  745.         }
  746.         /**
  747.          * Set resetExpire.
  748.          *
  749.          * @param \DateTime|null $resetExpire
  750.          *
  751.          * @return Customer
  752.          */
  753.         public function setResetExpire($resetExpire null)
  754.         {
  755.             $this->reset_expire $resetExpire;
  756.             return $this;
  757.         }
  758.         /**
  759.          * Get resetExpire.
  760.          *
  761.          * @return \DateTime|null
  762.          */
  763.         public function getResetExpire()
  764.         {
  765.             return $this->reset_expire;
  766.         }
  767.         /**
  768.          * Set createDate.
  769.          *
  770.          * @param \DateTime $createDate
  771.          *
  772.          * @return Customer
  773.          */
  774.         public function setCreateDate($createDate)
  775.         {
  776.             $this->create_date $createDate;
  777.             return $this;
  778.         }
  779.         /**
  780.          * Get createDate.
  781.          *
  782.          * @return \DateTime
  783.          */
  784.         public function getCreateDate()
  785.         {
  786.             return $this->create_date;
  787.         }
  788.         /**
  789.          * Set updateDate.
  790.          *
  791.          * @param \DateTime $updateDate
  792.          *
  793.          * @return Customer
  794.          */
  795.         public function setUpdateDate($updateDate)
  796.         {
  797.             $this->update_date $updateDate;
  798.             return $this;
  799.         }
  800.         /**
  801.          * Get updateDate.
  802.          *
  803.          * @return \DateTime
  804.          */
  805.         public function getUpdateDate()
  806.         {
  807.             return $this->update_date;
  808.         }
  809.         /**
  810.          * Add customerFavoriteProduct.
  811.          *
  812.          * @param \Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct
  813.          *
  814.          * @return Customer
  815.          */
  816.         public function addCustomerFavoriteProduct(CustomerFavoriteProduct $customerFavoriteProduct)
  817.         {
  818.             $this->CustomerFavoriteProducts[] = $customerFavoriteProduct;
  819.             return $this;
  820.         }
  821.         /**
  822.          * Remove customerFavoriteProduct.
  823.          *
  824.          * @param \Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct
  825.          *
  826.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  827.          */
  828.         public function removeCustomerFavoriteProduct(CustomerFavoriteProduct $customerFavoriteProduct)
  829.         {
  830.             return $this->CustomerFavoriteProducts->removeElement($customerFavoriteProduct);
  831.         }
  832.         /**
  833.          * Get customerFavoriteProducts.
  834.          *
  835.          * @return \Doctrine\Common\Collections\Collection
  836.          */
  837.         public function getCustomerFavoriteProducts()
  838.         {
  839.             return $this->CustomerFavoriteProducts;
  840.         }
  841.         /**
  842.          * Add customerAddress.
  843.          *
  844.          * @param \Eccube\Entity\CustomerAddress $customerAddress
  845.          *
  846.          * @return Customer
  847.          */
  848.         public function addCustomerAddress(CustomerAddress $customerAddress)
  849.         {
  850.             $this->CustomerAddresses[] = $customerAddress;
  851.             return $this;
  852.         }
  853.         /**
  854.          * Remove customerAddress.
  855.          *
  856.          * @param \Eccube\Entity\CustomerAddress $customerAddress
  857.          *
  858.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  859.          */
  860.         public function removeCustomerAddress(CustomerAddress $customerAddress)
  861.         {
  862.             return $this->CustomerAddresses->removeElement($customerAddress);
  863.         }
  864.         /**
  865.          * Get customerAddresses.
  866.          *
  867.          * @return \Doctrine\Common\Collections\Collection
  868.          */
  869.         public function getCustomerAddresses()
  870.         {
  871.             return $this->CustomerAddresses;
  872.         }
  873.         /**
  874.          * Add order.
  875.          *
  876.          * @param \Eccube\Entity\Order $order
  877.          *
  878.          * @return Customer
  879.          */
  880.         public function addOrder(Order $order)
  881.         {
  882.             $this->Orders[] = $order;
  883.             return $this;
  884.         }
  885.         /**
  886.          * Remove order.
  887.          *
  888.          * @param \Eccube\Entity\Order $order
  889.          *
  890.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  891.          */
  892.         public function removeOrder(Order $order)
  893.         {
  894.             return $this->Orders->removeElement($order);
  895.         }
  896.         /**
  897.          * Get orders.
  898.          *
  899.          * @return \Doctrine\Common\Collections\Collection
  900.          */
  901.         public function getOrders()
  902.         {
  903.             return $this->Orders;
  904.         }
  905.         /**
  906.          * Set status.
  907.          *
  908.          * @param \Eccube\Entity\Master\CustomerStatus|null $status
  909.          *
  910.          * @return Customer
  911.          */
  912.         public function setStatus(Master\CustomerStatus $status null)
  913.         {
  914.             $this->Status $status;
  915.             return $this;
  916.         }
  917.         /**
  918.          * Get status.
  919.          *
  920.          * @return \Eccube\Entity\Master\CustomerStatus|null
  921.          */
  922.         public function getStatus()
  923.         {
  924.             return $this->Status;
  925.         }
  926.         /**
  927.          * Set sex.
  928.          *
  929.          * @param \Eccube\Entity\Master\Sex|null $sex
  930.          *
  931.          * @return Customer
  932.          */
  933.         public function setSex(Master\Sex $sex null)
  934.         {
  935.             $this->Sex $sex;
  936.             return $this;
  937.         }
  938.         /**
  939.          * Get sex.
  940.          *
  941.          * @return \Eccube\Entity\Master\Sex|null
  942.          */
  943.         public function getSex()
  944.         {
  945.             return $this->Sex;
  946.         }
  947.         /**
  948.          * Set job.
  949.          *
  950.          * @param \Eccube\Entity\Master\Job|null $job
  951.          *
  952.          * @return Customer
  953.          */
  954.         public function setJob(Master\Job $job null)
  955.         {
  956.             $this->Job $job;
  957.             return $this;
  958.         }
  959.         /**
  960.          * Get job.
  961.          *
  962.          * @return \Eccube\Entity\Master\Job|null
  963.          */
  964.         public function getJob()
  965.         {
  966.             return $this->Job;
  967.         }
  968.         /**
  969.          * Set country.
  970.          *
  971.          * @param \Eccube\Entity\Master\Country|null $country
  972.          *
  973.          * @return Customer
  974.          */
  975.         public function setCountry(Master\Country $country null)
  976.         {
  977.             $this->Country $country;
  978.             return $this;
  979.         }
  980.         /**
  981.          * Get country.
  982.          *
  983.          * @return \Eccube\Entity\Master\Country|null
  984.          */
  985.         public function getCountry()
  986.         {
  987.             return $this->Country;
  988.         }
  989.         /**
  990.          * Set pref.
  991.          *
  992.          * @param \Eccube\Entity\Master\Pref|null $pref
  993.          *
  994.          * @return Customer
  995.          */
  996.         public function setPref(Master\Pref $pref null)
  997.         {
  998.             $this->Pref $pref;
  999.             return $this;
  1000.         }
  1001.         /**
  1002.          * Get pref.
  1003.          *
  1004.          * @return \Eccube\Entity\Master\Pref|null
  1005.          */
  1006.         public function getPref()
  1007.         {
  1008.             return $this->Pref;
  1009.         }
  1010.         /**
  1011.          * Set point
  1012.          *
  1013.          * @param string $point
  1014.          *
  1015.          * @return Customer
  1016.          */
  1017.         public function setPoint($point)
  1018.         {
  1019.             $this->point $point;
  1020.             return $this;
  1021.         }
  1022.         /**
  1023.          * Get point
  1024.          *
  1025.          * @return string
  1026.          */
  1027.         public function getPoint()
  1028.         {
  1029.             return $this->point;
  1030.         }
  1031.         /**
  1032.          * String representation of object
  1033.          *
  1034.          * @see http://php.net/manual/en/serializable.serialize.php
  1035.          *
  1036.          * @return string the string representation of the object or null
  1037.          *
  1038.          * @since 5.1.0
  1039.          */
  1040.         public function serialize()
  1041.         {
  1042.             // see https://symfony.com/doc/2.7/security/entity_provider.html#create-your-user-entity
  1043.             // CustomerRepository::loadUserByUsername() で Status をチェックしているため、ここでは不要
  1044.             return serialize([
  1045.                 $this->id,
  1046.                 $this->email,
  1047.                 $this->password,
  1048.                 $this->salt,
  1049.             ]);
  1050.         }
  1051.         /**
  1052.          * Constructs the object
  1053.          *
  1054.          * @see http://php.net/manual/en/serializable.unserialize.php
  1055.          *
  1056.          * @param string $serialized <p>
  1057.          * The string representation of the object.
  1058.          * </p>
  1059.          *
  1060.          * @return void
  1061.          *
  1062.          * @since 5.1.0
  1063.          */
  1064.         public function unserialize($serialized)
  1065.         {
  1066.             list(
  1067.                 $this->id,
  1068.                 $this->email,
  1069.                 $this->password,
  1070.                 $this->salt) = unserialize($serialized);
  1071.         }
  1072.     }
  1073. }