Gets address' customer.
public getCustomer ( ) : Sonata\Component\Customer\CustomerInterface | ||
return | Sonata\Component\Customer\CustomerInterface |
/** * {@inheritdoc} */ public function setCurrent(AddressInterface $address) { foreach ($address->getCustomer()->getAddressesByType($address->getType()) as $custAddress) { if ($custAddress->getCurrent()) { $custAddress->setCurrent(false); $this->save($custAddress); break; } } $address->setCurrent(true); $this->save($address); }
/** * Checks if $address is valid * * @param AddressInterface $address * * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ protected function checkAddress(AddressInterface $address = null) { if (null === $address || $address->getCustomer()->getId() !== $this->getCustomer()->getId()) { throw new NotFoundHttpException(); } }