From d35fe29a0ef9fadfe8141b6428b510860f35c3d0 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Mon, 6 Sep 2021 14:24:18 +0200 Subject: Use wpdb::get_row in Concert::get() Makes it clearer that we're just fetching _one_ row from the database. Also updated doc comment to hopefully be a bit clearer. --- includes/concert.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'includes') diff --git a/includes/concert.php b/includes/concert.php index 04305ce..ed22117 100644 --- a/includes/concert.php +++ b/includes/concert.php @@ -74,7 +74,7 @@ if ( !class_exists('GiglogAdmin_Concert') ) { } /** - * Get concert with given id. + * Return the concert with the given id. * * @param int $id. * @return null|self. @@ -86,14 +86,14 @@ if ( !class_exists('GiglogAdmin_Concert') ) { $query = self::BASE_QUERY . 'WHERE ' . $wpdb->prepare('wpg_concerts.id = %d', $id); - $results = $wpdb->get_results($query); + $res= $wpdb->get_row($query); - if ( !$results ) { + if ( !$res) { $wpdb->print_error( __METHOD__ ); return null; } - return new GiglogAdmin_Concert($results[0]); + return new GiglogAdmin_Concert($res); } public static function create(string $name, $venue, string $date, string $ticketlink, string $eventlink): ?self -- cgit v1.2.3