diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2021-05-09 17:19:22 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2021-05-09 17:19:22 +0200 |
commit | 8045b78bc2032f772e35d1bf484541332336c7e0 (patch) | |
tree | 28113ea639d17f295ebd17c190b9e748b7d520cf /includes/concert.php | |
parent | df7c0a5dbf772a535c383f31fab578b5f82cb337 (diff) | |
download | gigologadmin-8045b78bc2032f772e35d1bf484541332336c7e0.tar.gz gigologadmin-8045b78bc2032f772e35d1bf484541332336c7e0.tar.bz2 gigologadmin-8045b78bc2032f772e35d1bf484541332336c7e0.zip |
Fix constructing concerts if only venue id passed.
The previous changes required the full venue data to be included in the
constructor. This patch ensures that we handle the old case, where only
the venue id was passed in.
We still should get the full concert object including the venue name and
city back.
Diffstat (limited to 'includes/concert.php')
-rw-r--r-- | includes/concert.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/includes/concert.php b/includes/concert.php index 8c99c42..e3c32e8 100644 --- a/includes/concert.php +++ b/includes/concert.php @@ -31,13 +31,18 @@ if ( !class_exists('GiglogAdmin_Concert') ) { if ( isset( $attrs->venue ) ) { - $venue_attrs = (object) [ - "id" => $attrs->venue, - "wpgvenue_name" => $attrs->wpgvenue_name, - "wpgvenue_city" => $attrs->wpgvenue_city, - ]; - - $this->venue = new GiglogAdmin_Venue($venue_attrs); + if (isset($attrs->wpgvenue_name) && isset($attrs->wpgvenue_city)) { + $venue_attrs = (object) [ + "id" => $attrs->venue, + "wpgvenue_name" => $attrs->wpgvenue_name, + "wpgvenue_city" => $attrs->wpgvenue_city, + ]; + + $this->venue = new GiglogAdmin_Venue($venue_attrs); + } + else { + $this->venue = GiglogAdmin_Venue::get($attrs->venue); + } } } |