diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2021-05-09 21:38:41 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2021-05-09 21:38:41 +0200 |
commit | e570c572b8ccc377a74ab168f2698ac706400141 (patch) | |
tree | 76e06e8d62b7cd0fc3e12396d1d822e6079a82c4 /includes | |
parent | 142ff436282844677b8b4e7d8ececd44440ec96d (diff) | |
download | gigologadmin-e570c572b8ccc377a74ab168f2698ac706400141.tar.gz gigologadmin-e570c572b8ccc377a74ab168f2698ac706400141.tar.bz2 gigologadmin-e570c572b8ccc377a74ab168f2698ac706400141.zip |
Method to find concerts for a given city.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/concert.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/includes/concert.php b/includes/concert.php index e3c32e8..c773c12 100644 --- a/includes/concert.php +++ b/includes/concert.php @@ -170,6 +170,21 @@ if ( !class_exists('GiglogAdmin_Concert') ) { return $wpdb->get_results($sql); } + + public static function find_concerts_in(string $city) : array + { + global $wpdb; + + $query = 'SELECT wpg_concerts.*, wpg_venues.wpgvenue_name, wpg_venues.wpgvenue_city ' + . 'FROM wpg_concerts ' + . 'INNER JOIN wpg_venues ON wpg_concerts.venue = wpg_venues.id ' + . 'WHERE wpg_venues.wpgvenue_city = ' . $wpdb->prepare('%s', $city); + + $results = $wpdb->get_results($query); + + return array_map(function($c) { return new GiglogAdmin_Concert($c); }, $results); + } + public function save(): void { global $wpdb; |