Eccube\Entity\CustomerAddress::setCustomer PHP Méthode

setCustomer() public méthode

Set Customer
public setCustomer ( Customer $customer ) : CustomerAddress
$customer Customer
Résultat CustomerAddress
    public function setCustomer(\Eccube\Entity\Customer $customer)
    {
        $this->Customer = $customer;
        return $this;
    }

Usage Example

 /**
  * 非会員用複数配送設定時の新規お届け先の設定
  */
 public function shippingMultipleEdit(Application $app, Request $request)
 {
     // カートチェック
     if (!$app['eccube.service.cart']->isLocked()) {
         // カートが存在しない、カートがロックされていない時はエラー
         return $app->redirect($app->url('cart'));
     }
     // 非会員用Customerを取得
     $Customer = $app['eccube.service.shopping']->getNonMember($this->sessionKey);
     $CustomerAddress = new CustomerAddress();
     $CustomerAddress->setCustomer($Customer);
     $Customer->addCustomerAddress($CustomerAddress);
     $form = $app['form.factory']->createBuilder('shopping_shipping', $CustomerAddress)->getForm();
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         // 非会員用のセッションに追加
         $customerAddresses = $app['session']->get($this->sessionCustomerAddressKey);
         $customerAddresses = unserialize($customerAddresses);
         $customerAddresses[] = $CustomerAddress;
         $app['session']->set($this->sessionCustomerAddressKey, serialize($customerAddresses));
         return $app->redirect($app->url('shopping_shipping_multiple'));
     }
     return $app->render('Shopping/shipping_multiple_edit.twig', array('form' => $form->createView()));
 }
All Usage Examples Of Eccube\Entity\CustomerAddress::setCustomer