$id =
$row['__address_id'
];
$addresses[$id] =
$this->hydrator->
hydrate($row);
} return $addresses;
} private function createQuery(): QueryBuilder
{ $query =
$this->connection->
createQueryBuilder();
$query->
addSelect($this->fieldHelper->
getAddressFields());
$query->
addSelect($this->fieldHelper->
getCountryFields());
$query->
addSelect($this->fieldHelper->
getStateFields());
$query->
from('s_user_addresses', 'address'
);
$query->
leftJoin('address', 's_user_addresses_attributes', 'addressAttribute', 'addressAttribute.address_id = address.id'
);
$query->
leftJoin('address', 's_core_countries', 'country', 'country.id = address.country_id'
);
$query->
leftJoin('country', 's_core_countries_attributes', 'countryAttribute', 'countryAttribute.countryID = country.id'
);
$query->
leftJoin('address', 's_core_countries_states', 'countryState', 'countryState.id = address.state_id'
);
$query->
leftJoin('countryState', 's_core_countries_states_attributes', 'countryStateAttribute', 'countryStateAttribute.stateID = countryState.id'
);