Sonata\CustomerBundle\Entity\BaseCustomer::addAddress PHP Method

addAddress() public method

public addAddress ( Sonata\Component\Customer\AddressInterface $address )
$address Sonata\Component\Customer\AddressInterface
    public function addAddress(AddressInterface $address)
    {
        $address->setCustomer($this);
        if (count($this->getAddressesByType($address->getType())) === 0) {
            $address->setCurrent(true);
        }
        $this->getAddresses()->add($address);
        if (null === $this->getFirstname()) {
            $this->setFirstname($address->getFirstname());
        }
        if (null === $this->getLastname()) {
            $this->setLastname($address->getLastname());
        }
        if (null === $this->getPhoneNumber()) {
            $this->setPhoneNumber($address->getPhone());
        }
    }