/** * 非会員の Customer オブジェクトを生成して返す. * * @param string $email メールアドレス. null の場合は, ランダムなメールアドレスが生成される. * @return \Eccube\Entity\Customer */ public function createNonMember($email = null) { $sessionKey = 'eccube.front.shopping.nonmember'; $sessionCustomerAddressKey = 'eccube.front.shopping.nonmember.customeraddress'; $faker = $this->getFaker(); $Customer = new Customer(); if (is_null($email)) { $email = $faker->email; } $Pref = $this->app['eccube.repository.master.pref']->find(1); $Customer->setName01($faker->lastName)->setName02($faker->firstName)->setEmail($email)->setPref($Pref)->setDelFlg(Constant::DISABLED); $CustomerAddress = new CustomerAddress(); $CustomerAddress->setCustomer($Customer)->setDelFlg(Constant::DISABLED); $CustomerAddress->copyProperties($Customer); $Customer->addCustomerAddress($CustomerAddress); $nonMember = array(); $nonMember['customer'] = $Customer; $nonMember['pref'] = $Customer->getPref()->getId(); $this->app['session']->set($sessionKey, $nonMember); $customerAddresses = array(); $customerAddresses[] = $CustomerAddress; $this->app['session']->set($sessionCustomerAddressKey, serialize($customerAddresses)); return $Customer; }
/** * 非会員の Customer オブジェクトを生成して返す. * * @param string $email メールアドレス. null の場合は, ランダムなメールアドレスが生成される. * @return \Eccube\Entity\Customer */ public function createNonMember($email = null) { $sessionKey = 'eccube.front.shopping.nonmember'; $sessionCustomerAddressKey = 'eccube.front.shopping.nonmember.customeraddress'; $faker = $this->getFaker(); $Customer = new Customer(); if (is_null($email)) { $email = $faker->safeEmail; } $Pref = $this->app['eccube.repository.master.pref']->find($faker->numberBetween(1, 47)); $tel = explode('-', $faker->phoneNumber); $fax = explode('-', $faker->phoneNumber); $Customer->setName01($faker->lastName)->setName02($faker->firstName)->setKana01($faker->lastKanaName)->setKana02($faker->firstKanaName)->setCompanyName($faker->company)->setEmail($email)->setZip01($faker->postcode1())->setZip02($faker->postcode2())->setPref($Pref)->setAddr01($faker->city)->setAddr02($faker->streetAddress)->setTel01($tel[0])->setTel02($tel[1])->setTel03($tel[2])->setFax01($fax[0])->setFax02($fax[1])->setFax03($fax[2])->setDelFlg(Constant::DISABLED); $CustomerAddress = new CustomerAddress(); $CustomerAddress->setCustomer($Customer)->setDelFlg(Constant::DISABLED); $CustomerAddress->copyProperties($Customer); $Customer->addCustomerAddress($CustomerAddress); $nonMember = array(); $nonMember['customer'] = $Customer; $nonMember['pref'] = $Customer->getPref()->getId(); $this->app['session']->set($sessionKey, $nonMember); $customerAddresses = array(); $customerAddresses[] = $CustomerAddress; $this->app['session']->set($sessionCustomerAddressKey, serialize($customerAddresses)); return $Customer; }