/** * Customer オブジェクトを生成して返す. * * @param string $email メールアドレス. null の場合は, ランダムなメールアドレスが生成される. * @return \Eccube\Entity\Customer */ public function createCustomer($email = null) { $faker = $this->getFaker(); $Customer = new Customer(); if (is_null($email)) { $email = $faker->email; } $Status = $this->app['orm.em']->getRepository('Eccube\\Entity\\Master\\CustomerStatus')->find(CustomerStatus::ACTIVE); $Pref = $this->app['eccube.repository.master.pref']->find(1); $Customer->setName01($faker->lastName)->setName02($faker->firstName)->setEmail($email)->setPref($Pref)->setPassword('password')->setSalt($this->app['eccube.repository.customer']->createSalt(5))->setSecretKey($this->app['eccube.repository.customer']->getUniqueSecretKey($this->app))->setStatus($Status)->setDelFlg(Constant::DISABLED); $Customer->setPassword($this->app['eccube.repository.customer']->encryptPassword($this->app, $Customer)); $this->app['orm.em']->persist($Customer); $this->app['orm.em']->flush($Customer); $CustomerAddress = new CustomerAddress(); $CustomerAddress->setCustomer($Customer)->setDelFlg(Constant::DISABLED); $CustomerAddress->copyProperties($Customer); $this->app['orm.em']->persist($CustomerAddress); $this->app['orm.em']->flush($CustomerAddress); return $Customer; }
/** * Customer オブジェクトを生成して返す. * * @param string $email メールアドレス. null の場合は, ランダムなメールアドレスが生成される. * @return \Eccube\Entity\Customer */ public function createCustomer($email = null) { $faker = $this->getFaker(); $Customer = new Customer(); if (is_null($email)) { $email = $faker->safeEmail; } $tel = explode('-', $faker->phoneNumber); $fax = explode('-', $faker->phoneNumber); $Status = $this->app['orm.em']->getRepository('Eccube\\Entity\\Master\\CustomerStatus')->find(CustomerStatus::ACTIVE); $Pref = $this->app['eccube.repository.master.pref']->find($faker->numberBetween(1, 47)); $Sex = $this->app['eccube.repository.master.sex']->find($faker->numberBetween(1, 2)); $Job = $this->app['orm.em']->getRepository('Eccube\\Entity\\Master\\Job')->find($faker->numberBetween(1, 18)); $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])->setBirth($faker->dateTimeThisDecade())->setSex($Sex)->setJob($Job)->setPassword('password')->setSalt($this->app['eccube.repository.customer']->createSalt(5))->setSecretKey($this->app['eccube.repository.customer']->getUniqueSecretKey($this->app))->setStatus($Status)->setDelFlg(Constant::DISABLED); $Customer->setPassword($this->app['eccube.repository.customer']->encryptPassword($this->app, $Customer)); $this->app['orm.em']->persist($Customer); $this->app['orm.em']->flush($Customer); $CustomerAddress = new CustomerAddress(); $CustomerAddress->setCustomer($Customer)->setDelFlg(Constant::DISABLED); $CustomerAddress->copyProperties($Customer); $this->app['orm.em']->persist($CustomerAddress); $this->app['orm.em']->flush($CustomerAddress); return $Customer; }
/** * Customer オブジェクトを生成して返す. * * @param string $email メールアドレス. null の場合は, ランダムなメールアドレスが生成される. * @return \Eccube\Entity\Customer */ public function createCustomer($email = null) { $faker = $this->getFaker(); $Customer = new Customer(); if (is_null($email)) { $email = $faker->email; } $Status = $this->app['orm.em']->getRepository('Eccube\\Entity\\Master\\CustomerStatus')->find(CustomerStatus::ACTIVE); $Customer->setName01($faker->lastName)->setName02($faker->firstName)->setEmail($email)->setPassword('password')->setSecretKey($this->app['eccube.repository.customer']->getUniqueSecretKey($this->app))->setStatus($Status)->setDelFlg(0); $Customer->setPassword($this->app['eccube.repository.customer']->encryptPassword($this->app, $Customer)); $this->app['orm.em']->persist($Customer); $this->app['orm.em']->flush(); return $Customer; }