/**
  * @param int|null $idCustomerAddress
  *
  * @return array
  */
 public function getData($idCustomerAddress = null)
 {
     if ($idCustomerAddress === null) {
         return [];
     }
     $addressEntity = $this->customerQueryContainer->queryAddress($idCustomerAddress)->findOne();
     return $addressEntity->toArray();
 }
示例#2
0
 /**
  * @param int $idAddress
  * @param int|null $idCustomer
  *
  * @throws \Spryker\Zed\Customer\Business\Exception\AddressNotFoundException
  *
  * @return \Generated\Shared\Transfer\AddressTransfer
  */
 protected function getAddressTransferById($idAddress, $idCustomer = null)
 {
     $addressQuery = $this->queryContainer->queryAddress($idAddress);
     if ($idCustomer !== null) {
         $addressQuery->filterByFkCustomer($idCustomer);
     }
     $addressEntity = $addressQuery->findOne();
     if ($addressEntity === null) {
         throw new AddressNotFoundException(sprintf('Address not found for ID `%s` (and optional customer ID `%s`).', $idAddress, $idCustomer));
     }
     $addressTransfer = $this->entityToAddressTransfer($addressEntity);
     return $addressTransfer;
 }