/**
  * Returns the customer class id
  *
  * @return integer|null
  */
 protected function getCustomerClassId()
 {
     try {
         return PlentymarketsMappingController::getCustomerClassByShopwareID($this->Customer->getGroup()->getId());
     } catch (Exception $E) {
         PyLog()->debug($E->getMessage());
         return null;
     }
 }
示例#2
0
 /**
  * @depends testCanCreateEntity
  */
 public function testCanUpdateEntityWithReference(Shopware\Models\Customer\Customer $customer)
 {
     $groupId = $customer->getGroup()->getId();
     $groupKey = $customer->getGroup()->getKey();
     $customer = new Customer();
     $customer->setEmail('*****@*****.**');
     $this->em->persist($customer);
     $this->em->flush();
     $customerId = $customer->getId();
     $this->em->clear();
     $customer = $this->em->find('Shopware\\Models\\Customer\\Customer', $customerId);
     $group = $this->em->getReference('Shopware\\Models\\Customer\\Group', $groupId);
     $customer->setGroup($group);
     $this->assertNotEmpty($customer->getId());
     $this->assertEquals($group, $customer->getGroup());
     $this->assertNotEmpty($customer->getGroup()->getId());
     $this->assertEquals($groupKey, $customer->getGroup()->getKey());
     return $customer;
 }
示例#3
0
 public function testCanCreateEntityWithNewGroup()
 {
     $this->em->clear();
     $groupKey = $this->generateRandomString(5);
     $group = new Group();
     $group->setKey($groupKey);
     $customer = new Customer();
     $customer->setGroup($group);
     $this->assertEmpty($customer->getId());
     $this->assertEquals($group, $customer->getGroup());
     $this->assertEmpty($customer->getGroup()->getId());
     $this->assertEquals($groupKey, $customer->getGroup()->getKey());
     return $customer;
 }