/** * {@inheritdoc} */ public function addType(AddressType $type) { if (!$this->hasTypeWithName($type->getName())) { $addressToType = $this->createAddressToAddressTypeEntity(); $addressToType->setType($type); $addressToType->setAddress($this); $this->types->add($addressToType); } return $this; }
public function testName() { $this->assertEquals('billing', $this->type->getName()); }
/** * Gets one address that has specified type. * * @param AddressType $type * * @return ContactAddress|null */ public function getAddressByType(AddressType $type) { return $this->getAddressByTypeName($type->getName()); }
/** * @param AddressType $object * @param mixed $format * @param array $context * @return array */ public function normalize($object, $format = null, array $context = array()) { return $object->getName(); }
/** * Remove address type * * @param AddressType $type * @return CustomerAddress */ public function removeType(AddressType $type) { /** @var CustomerAddressToAddressType $addressesToType */ foreach ($this->getAddressesToTypes() as $addressesToType) { if ($addressesToType->getType()->getName() === $type->getName()) { $this->removeAddressesToType($addressesToType); } } return $this; }
/** * @param string $key * @param AddressType $entity */ public function fillEntityData($key, $entity) { $label = ucfirst($entity->getName()) . ' Type'; $entity->setLabel($label); }