Created
October 17, 2017 09:38
-
-
Save suresh-kumara-gist/3c16eab505a9e6e33eeee68a5497f3dd to your computer and use it in GitHub Desktop.
drupal 8 address field fetch city
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| change node__field_location to your address field table name , column name also | |
| $query = \Drupal::database()->select('node__field_location', 'fa'); | |
| $query->fields('fa', ['field_location_locality']); | |
| $query->condition('bundle', 'venture'); | |
| // $query->condition('field_location_locality', '', 'like'); | |
| // $query->condition('field_location_country_code', ''); | |
| $query->distinct(); | |
| $query->orderBy('field_location_locality'); | |
| $courseRatings = $query->execute()->fetchAll(\PDO::FETCH_ASSOC); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment