/** * @param $firstName * @param $lastname */ protected function createCustomer($firstName, $lastname) { $customer = new Customer(); $customer->setChannel($this->getReference('integration')); $customer->setDataChannel($this->getReference('default_channel')); $customer->setFirstName($firstName); $customer->setLastName($lastname); $customer->setEmail(strtolower($firstName . '_' . $lastname . '@example.com')); $customer->setIsActive(true); $customer->setWebsite($this->getReference('website')); $customer->setStore($this->getReference('store')); $customer->setAccount($this->getReference('account')); $customer->setGender(Gender::MALE); $customer->setGroup($this->getReference('customer_group')); $customer->setCreatedAt(new \DateTime('now')); $customer->setUpdatedAt(new \DateTime('now')); $customer->setOwner($this->user); $customer->setOrganization($this->organization); $this->em->persist($customer); }
/** * @param $oid * @param Account $account * @param MagentoAddress $address * * @return Customer */ protected function createCustomer($oid, Account $account, MagentoAddress $address) { $customer = new Customer(); $customer->setChannel($this->integration); $customer->setDataChannel($this->channel); $customer->setFirstName('John'); $customer->setLastName('Doe'); $customer->setEmail('*****@*****.**'); $customer->setOriginId($oid); $customer->setIsActive(true); $customer->setWebsite($this->website); $customer->setStore($this->store); $customer->setAccount($account); $customer->setGender(Gender::MALE); $customer->setGroup($this->customerGroup); $customer->setCreatedAt(new \DateTime('now')); $customer->setUpdatedAt(new \DateTime('now')); $customer->addAddress($address); $customer->setOwner($this->getUser()); $customer->setOrganization($this->organization); $this->em->persist($customer); return $customer; }
/** * @param $oid * @param Account $account * @param MagentoAddress $address * * @return Customer */ protected function createCustomer($oid, Account $account, MagentoAddress $address) { $customer = new Customer(); $customer->setChannel($this->integration); $customer->setDataChannel($this->channel); $customer->setFirstName('John'); $customer->setLastName('Doe'); $customer->setEmail('*****@*****.**'); $customer->setOriginId($oid); $customer->setIsActive(true); $customer->setWebsite($this->website); $customer->setStore($this->store); $customer->setAccount($account); $customer->setGender(Gender::MALE); $customer->setGroup($this->customerGroup); // TODO: DateTimeZones should be removed in BAP-8710. Tests should be passed for: // - OroCRM\Bundle\MagentoBundle\Tests\Functional\Controller\Api\Rest\CustomerControllerTest // - OroCRM\Bundle\MagentoBundle\Tests\Functional\Controller\Api\Rest\MagentoCustomerControllerTest $customer->setCreatedAt(new \DateTime('now', new \DateTimezone('UTC'))); $customer->setUpdatedAt(new \DateTime('now', new \DateTimezone('UTC'))); $customer->addAddress($address); $customer->setOwner($this->getUser()); $customer->setOrganization($this->organization); $this->em->persist($customer); return $customer; }
/** * @param ObjectManager $om * @param Website $website * @param Store $store * @param CustomerGroup $group * @param Integration $integration */ protected function persistDemoCustomers(ObjectManager $om, Website $website, Store $store, CustomerGroup $group, Integration $integration) { $accounts = $om->getRepository('OroCRMAccountBundle:Account')->findAll(); $contacts = $om->getRepository('OroCRMContactBundle:Contact')->findAll(); $buffer = range(0, 48); shuffle($buffer); for ($i = 0; $i < 49; ++$i) { $birthday = $this->generateBirthday(); /** @var Contact $contact */ $contact = $contacts[$buffer[$i]]; $customer = new Customer(); if (is_null($accounts[$buffer[$i]])) { var_dump($buffer[$i]); } $customer->setWebsite($website)->setChannel($integration)->setStore($store)->setFirstName($contact->getFirstName())->setLastName($contact->getLastName())->setEmail($contact->getPrimaryEmail())->setBirthday($birthday)->setVat(self::VAT)->setGroup($group)->setCreatedAt(new \DateTime('now'))->setUpdatedAt(new \DateTime('now'))->setOriginId($i + 1)->setAccount($accounts[$buffer[$i]])->setContact($contact)->setOrganization($this->organization)->setOwner($this->getRandomOwner()); $customer->setDataChannel($this->dataChannel); $om->persist($customer); } }