protected function createB2bCustomer() { $customer = new B2bCustomer(); $customer->setAccount($this->getReference('default_account')); $customer->setName(self::CUSTOMER_NAME); $customer->setDataChannel($this->getReference('default_channel')); $customer->setOrganization($this->organization); $this->em->persist($customer); $this->em->flush(); $this->setReference('default_b2bcustomer', $customer); return $this; }
/** * @param Organization $organization * @param array $data * @param Channel $channel * * @return B2bCustomer */ protected function createCustomer(Organization $organization, $data, Channel $channel = null) { $address = new Address(); $customer = new B2bCustomer(); $customer->setName($data['Company']); $customer->setOwner($this->getRandomUserReference()); $customer->setAccount($this->getAccount()); $customer->setOrganization($organization); $address->setCity($data['City']); $address->setStreet($data['StreetAddress']); $address->setPostalCode($data['ZipCode']); $address->setFirstName($data['GivenName']); $address->setLastName($data['Surname']); $address->setCountry($this->getCountryReference($data['Country'])); $address->setRegion($this->getRegionReference($data['Country'], $data['State'])); $customer->setShippingAddress($address); $customer->setBillingAddress(clone $address); if ($channel) { $customer->setDataChannel($channel); } return $customer; }