Beispiel #1
0
 /**
  * @param string $key
  * @param ContactAddress $entity
  */
 public function fillEntityData($key, $entity)
 {
     $typeRepository = $this->templateManager->getEntityRepository('Oro\\Bundle\\AddressBundle\\Entity\\AddressType');
     $billingType = $typeRepository->getEntity(AddressType::TYPE_BILLING);
     $shippingType = $typeRepository->getEntity(AddressType::TYPE_SHIPPING);
     switch ($key) {
         case 'Jerry Coleman':
             $entity->addType($billingType)->addType($shippingType);
             break;
         case 'John Smith':
             $entity->addType($billingType);
             break;
         case 'John Doo':
             $entity->addType($shippingType);
             break;
     }
     parent::fillEntityData($key, $entity);
 }
Beispiel #2
0
 public function testSetAddressType()
 {
     $contact = new Contact();
     $shippingType = new AddressType('shipping');
     $addressOne = new ContactAddress();
     $addressOne->addType($shippingType);
     $contact->addAddress($addressOne);
     $addressTwo = new ContactAddress();
     $contact->addAddress($addressTwo);
     $contact->setAddressType($addressTwo, $shippingType);
     $this->assertFalse($addressOne->hasTypeWithName('shipping'));
     $this->assertTrue($addressTwo->hasTypeWithName('shipping'));
 }