diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2021-04-14 00:22:58 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2021-04-14 00:22:58 +0200 |
commit | e618cdb494702dee8a62221bbafe2da61faba308 (patch) | |
tree | 06848a23562c3d02282fd6051bd1d82e3bae76dd /includes/concert.php | |
parent | 52669bd198671f275902f705d3b630a4b2d7c1b8 (diff) | |
download | gigologadmin-e618cdb494702dee8a62221bbafe2da61faba308.tar.gz gigologadmin-e618cdb494702dee8a62221bbafe2da61faba308.tar.bz2 gigologadmin-e618cdb494702dee8a62221bbafe2da61faba308.zip |
Make Concert constructor public.
Also allow it to default initialize when passing no args. Not entirely
sure about making this interface public.
Diffstat (limited to 'includes/concert.php')
-rw-r--r-- | includes/concert.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/includes/concert.php b/includes/concert.php index 7453319..3084eb4 100644 --- a/includes/concert.php +++ b/includes/concert.php @@ -32,7 +32,7 @@ if ( !class_exists('GiglogAdmin_Concert') ) { * so this constructor can be used to construct the object * directly from the database row. */ - private function __construct($attrs) + public function __construct($attrs = []) { $this->id = isset($attrs->id) ? $attrs->id : NULL; $this->band = isset($attrs->band) ? $attrs->band : NULL; @@ -59,7 +59,9 @@ if ( !class_exists('GiglogAdmin_Concert') ) { static function find_cid($id) - { global $wpdb; + { + global $wpdb; + if(!empty($id)) { $csql = 'SELECT * FROM wpg_concerts WHERE id="' . $id . '"'; @@ -70,8 +72,8 @@ if ( !class_exists('GiglogAdmin_Concert') ) { } } else - { $arr = array_fill(0, 6, null); - return new GiglogAdmin_Concert($arr); + { + return new GiglogAdmin_Concert(); } } |