setName01() public method

Set name01
public setName01 ( string $name01 ) : Customer
$name01 string
return Customer
Esempio n. 1
0
 /**
  * 非会員処理
  */
 public function nonmember(Application $app, Request $request)
 {
     $cartService = $app['eccube.service.cart'];
     // カートチェック
     if (!$cartService->isLocked()) {
         // カートが存在しない、カートがロックされていない時はエラー
         return $app->redirect($app->url('cart'));
     }
     // ログイン済みの場合は, 購入画面へリダイレクト.
     if ($app->isGranted('ROLE_USER')) {
         return $app->redirect($app->url('shopping'));
     }
     // カートチェック
     if (count($cartService->getCart()->getCartItems()) <= 0) {
         // カートが存在しない時はエラー
         return $app->redirect($app->url('cart'));
     }
     $form = $app['form.factory']->createBuilder('nonmember')->getForm();
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         $data = $form->getData();
         $Customer = new Customer();
         $Customer->setName01($data['name01'])->setName02($data['name02'])->setKana01($data['kana01'])->setKana02($data['kana02'])->setCompanyName($data['company_name'])->setEmail($data['email'])->setTel01($data['tel01'])->setTel02($data['tel02'])->setTel03($data['tel03'])->setZip01($data['zip01'])->setZip02($data['zip02'])->setZipCode($data['zip01'] . $data['zip02'])->setPref($data['pref'])->setAddr01($data['addr01'])->setAddr02($data['addr02']);
         // 非会員複数配送用
         $CustomerAddress = new CustomerAddress();
         $CustomerAddress->setCustomer($Customer)->setName01($data['name01'])->setName02($data['name02'])->setKana01($data['kana01'])->setKana02($data['kana02'])->setCompanyName($data['company_name'])->setTel01($data['tel01'])->setTel02($data['tel02'])->setTel03($data['tel03'])->setZip01($data['zip01'])->setZip02($data['zip02'])->setZipCode($data['zip01'] . $data['zip02'])->setPref($data['pref'])->setAddr01($data['addr01'])->setAddr02($data['addr02'])->setDelFlg(Constant::DISABLED);
         $Customer->addCustomerAddress($CustomerAddress);
         // 受注情報を取得
         $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
         // 初回アクセス(受注データがない)の場合は, 受注情報を作成
         if (is_null($Order)) {
             // 受注情報を作成
             try {
                 // 受注情報を作成
                 $app['eccube.service.shopping']->createOrder($Customer);
             } catch (CartException $e) {
                 $app->addRequestError($e->getMessage());
                 return $app->redirect($app->url('cart'));
             }
         }
         // 非会員用セッションを作成
         $nonMember = array();
         $nonMember['customer'] = $Customer;
         $nonMember['pref'] = $Customer->getPref()->getId();
         $app['session']->set($this->sessionKey, $nonMember);
         $customerAddresses = array();
         $customerAddresses[] = $CustomerAddress;
         $app['session']->set($this->sessionCustomerAddressKey, serialize($customerAddresses));
         return $app->redirect($app->url('shopping'));
     }
     return $app->render('Shopping/nonmember.twig', array('form' => $form->createView()));
 }
Esempio n. 2
0
 /**
  * 非会員の 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;
 }
Esempio n. 3
0
 /**
  * 非会員の 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;
 }
Esempio n. 4
0
 /**
  * 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;
 }
Esempio n. 5
0
 /**
  * 非会員処理
  */
 public function nonmember(Application $app, Request $request)
 {
     $cartService = $app['eccube.service.cart'];
     // カートチェック
     if (!$cartService->isLocked()) {
         // カートが存在しない、カートがロックされていない時はエラー
         log_info('カートが存在しません');
         return $app->redirect($app->url('cart'));
     }
     // ログイン済みの場合は, 購入画面へリダイレクト.
     if ($app->isGranted('ROLE_USER')) {
         return $app->redirect($app->url('shopping'));
     }
     // カートチェック
     if (count($cartService->getCart()->getCartItems()) <= 0) {
         // カートが存在しない時はエラー
         log_info('カートに商品が入っていないためショッピングカート画面にリダイレクト');
         return $app->redirect($app->url('cart'));
     }
     $builder = $app['form.factory']->createBuilder('nonmember');
     $event = new EventArgs(array('builder' => $builder), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_NONMEMBER_INITIALIZE, $event);
     $form = $builder->getForm();
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         log_info('非会員お客様情報登録開始');
         $data = $form->getData();
         $Customer = new Customer();
         $Customer->setName01($data['name01'])->setName02($data['name02'])->setKana01($data['kana01'])->setKana02($data['kana02'])->setCompanyName($data['company_name'])->setEmail($data['email'])->setTel01($data['tel01'])->setTel02($data['tel02'])->setTel03($data['tel03'])->setZip01($data['zip01'])->setZip02($data['zip02'])->setZipCode($data['zip01'] . $data['zip02'])->setPref($data['pref'])->setAddr01($data['addr01'])->setAddr02($data['addr02']);
         // 非会員複数配送用
         $CustomerAddress = new CustomerAddress();
         $CustomerAddress->setCustomer($Customer)->setName01($data['name01'])->setName02($data['name02'])->setKana01($data['kana01'])->setKana02($data['kana02'])->setCompanyName($data['company_name'])->setTel01($data['tel01'])->setTel02($data['tel02'])->setTel03($data['tel03'])->setZip01($data['zip01'])->setZip02($data['zip02'])->setZipCode($data['zip01'] . $data['zip02'])->setPref($data['pref'])->setAddr01($data['addr01'])->setAddr02($data['addr02'])->setDelFlg(Constant::DISABLED);
         $Customer->addCustomerAddress($CustomerAddress);
         // 受注情報を取得
         $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
         // 初回アクセス(受注データがない)の場合は, 受注情報を作成
         if (is_null($Order)) {
             // 受注情報を作成
             try {
                 // 受注情報を作成
                 $Order = $app['eccube.service.shopping']->createOrder($Customer);
             } catch (CartException $e) {
                 $app->addRequestError($e->getMessage());
                 return $app->redirect($app->url('cart'));
             }
         }
         // 非会員用セッションを作成
         $nonMember = array();
         $nonMember['customer'] = $Customer;
         $nonMember['pref'] = $Customer->getPref()->getId();
         $app['session']->set($this->sessionKey, $nonMember);
         $customerAddresses = array();
         $customerAddresses[] = $CustomerAddress;
         $app['session']->set($this->sessionCustomerAddressKey, serialize($customerAddresses));
         $event = new EventArgs(array('form' => $form, 'Order' => $Order), $request);
         $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_NONMEMBER_COMPLETE, $event);
         if ($event->getResponse() !== null) {
             return $event->getResponse();
         }
         log_info('非会員お客様情報登録完了', array($Order->getId()));
         return $app->redirect($app->url('shopping'));
     }
     return $app->render('Shopping/nonmember.twig', array('form' => $form->createView()));
 }