diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2021-05-09 22:12:21 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2021-05-09 22:12:21 +0200 |
commit | 61c48191a8e9ab757be4bf845072f4cfdbf9075f (patch) | |
tree | d26c746ff3ce8b5e7c176aada8e26adccb25e918 /includes/concert.php | |
parent | e570c572b8ccc377a74ab168f2698ac706400141 (diff) | |
download | gigologadmin-61c48191a8e9ab757be4bf845072f4cfdbf9075f.tar.gz gigologadmin-61c48191a8e9ab757be4bf845072f4cfdbf9075f.tar.bz2 gigologadmin-61c48191a8e9ab757be4bf845072f4cfdbf9075f.zip |
Method to find concerts at given venue
Diffstat (limited to 'includes/concert.php')
-rw-r--r-- | includes/concert.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/includes/concert.php b/includes/concert.php index c773c12..050c924 100644 --- a/includes/concert.php +++ b/includes/concert.php @@ -185,6 +185,20 @@ if ( !class_exists('GiglogAdmin_Concert') ) { return array_map(function($c) { return new GiglogAdmin_Concert($c); }, $results); } + public static function find_concerts_at(GiglogAdmin_Venue $venue) : 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_concerts.venue = ' . $wpdb->prepare('%d', $venue->id()); + + $results = $wpdb->get_results($query); + + return array_map(function($c) { return new GiglogAdmin_Concert($c); }, $results); + } + public function save(): void { global $wpdb; |