public function findAddress($customerId, $addressId)
    {
        $response = $this
            ->createQueryBuilder('c')
            ->select(
                ['c', 'a']
            )
            ->innerJoin('c.addresses', 'a')
            ->where('c.id = :customerId')
            ->andWhere('a.id = :addressId')
            ->setParameter('customerId', $customerId)
            ->setParameter('addressId', $addressId)
            ->setMaxResults(1)
            ->getQuery()
            ->getResult();

        if (!empty($response)) {
            /**
             * @var CustomerInterface $customer
             */
            $customer = reset($response);
            $addresses = $customer->getAddresses();
            if ($addresses) {
                return $addresses->first();
            }
        }

        return false;
    }
public function findAddress($customerId, $addressId)
    {
        $response = $this
            ->createQueryBuilder('c')
            ->select(
                ['c', 'a']
            )
            ->innerJoin('c.addresses', 'a')
            ->where('c.id = :customerId')
            ->andWhere('a.id = :addressId')
            ->setParameter('customerId', $customerId)
            ->setParameter('addressId', $addressId)
            ->setMaxResults(1)
            ->getQuery()
            ->getResult();

        if (!empty($response)) {
            /**
             * @var CustomerInterface $customer
             */
            $customer = reset($response);
            $addresses = $customer->getAddresses();
            if ($addresses) {
                return $addresses->first();
            }
        }

        return false;
    }
public function findAddress ( $ customerId , $ addressId ) { $ response = $ this -> createQueryBuilder ( 'c' ) -> select ( [ 'c' , 'a' ] ) -> innerJoin ( 'c.addresses' , 'a' ) -> where ( 'c.id = :customerId' ) -> andWhere ( 'a.id = :addressId' ) -> setParameter ( 'customerId' , $ customerId ) -> setParameter ( 'addressId' , $ addressId ) -> setMaxResults ( 1 ) -> getQuery ( ) -> getResult ( ) ; if ( ! empty ( $ response ) ) { /**
             * @var CustomerInterface $customer
             */ $ customer = reset ( $ response ) ; $ addresses = $ customer -> getAddresses ( ) ; if ( $ addresses ) { return $ addresses -> first ( ) ; } } return false ; }
Find a user address by it's id.

@param int $customerId The customer Id
@param int $addressId  The address Id

@return bool
Find a user address by it s id .