Автор: Adam Piotrowski (adam@wellcommerce.org)
Наследование: implements WellCommerce\Bundle\ClientBundle\Entity\ClientShippingAddressInterface
Пример #1
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     if (!$this->isEnabled()) {
         return;
     }
     $email = '*****@*****.**';
     $fakerGenerator = $this->getFakerGenerator();
     $firstName = $fakerGenerator->firstName;
     $lastName = $fakerGenerator->lastName;
     $clientGroup = $this->getReference('client_group');
     $client = $this->container->get('client.factory')->create();
     $client->getContactDetails()->setFirstName($firstName);
     $client->getContactDetails()->setLastName($lastName);
     $client->getContactDetails()->setEmail($email);
     $client->getContactDetails()->setPhone($fakerGenerator->phoneNumber);
     $client->getClientDetails()->setDiscount(25);
     $client->getClientDetails()->setUsername($email);
     $client->getClientDetails()->setPassword('demo');
     $client->getClientDetails()->setConditionsAccepted(true);
     $client->getClientDetails()->setNewsletterAccepted(true);
     $client->setClientGroup($clientGroup);
     $billingAddress = new ClientBillingAddress();
     $billingAddress->setFirstName($firstName);
     $billingAddress->setLastName($lastName);
     $billingAddress->setStreet($fakerGenerator->streetName);
     $billingAddress->setStreetNo($fakerGenerator->streetSuffix);
     $billingAddress->setFlatNo($fakerGenerator->buildingNumber);
     $billingAddress->setPostCode($fakerGenerator->postcode);
     $billingAddress->setCity($fakerGenerator->city);
     $billingAddress->setCountry($fakerGenerator->countryCode);
     $billingAddress->setVatId(666777888999);
     $billingAddress->setCompanyName($fakerGenerator->company);
     $shippingAddress = new ClientShippingAddress();
     $shippingAddress->setFirstName($firstName);
     $shippingAddress->setLastName($lastName);
     $shippingAddress->setStreet($fakerGenerator->streetName);
     $shippingAddress->setStreetNo($fakerGenerator->streetSuffix);
     $shippingAddress->setFlatNo($fakerGenerator->buildingNumber);
     $shippingAddress->setPostCode($fakerGenerator->postcode);
     $shippingAddress->setCity($fakerGenerator->city);
     $shippingAddress->setCountry($fakerGenerator->countryCode);
     $client->setBillingAddress($billingAddress);
     $client->setShippingAddress($shippingAddress);
     $client->setShop($this->getReference('shop'));
     $manager->persist($client);
     $manager->flush();
 }
 public function create() : ClientShippingAddressInterface
 {
     $address = new ClientShippingAddress();
     $address->setFirstName('');
     $address->setLastName('');
     $address->setLine1('');
     $address->setLine2('');
     $address->setPostalCode('');
     $address->setState('');
     $address->setCity('');
     $address->setCountry($this->shopStorage->getCurrentShop()->getDefaultCountry());
     $address->setCopyBillingAddress(true);
     return $address;
 }