diff --git a/app/model/Teamtable.php b/app/model/Teamtable.php index 741d15a..daefedc 100644 --- a/app/model/Teamtable.php +++ b/app/model/Teamtable.php @@ -61,9 +61,8 @@ class Teamtable $sth = $this->dbh->prepare( 'INSERT INTO lagtabell (LagNavn, Bedrift, Kortnummer, Lagleder, Telefon, Deltagere, Runder) VALUES (?, ?, ?, ?, ?, ?, ?)' ); - $template = $this->emptyTeamTemplate; - $template = [ + $sth->execute([ $template['LagNavn'], $template['Bedrift'], $template['Kortnummer'], @@ -71,8 +70,7 @@ class Teamtable $template['Telefon'], $template['Deltagere'], $template['Runder'], - ]; - $sth->execute($template); + ]); return $this->dbh->lastInsertId(); } @@ -80,18 +78,12 @@ class Teamtable public function isEqualEmptyTemplate(array $team): bool { $template = $this->emptyTeamTemplate; - $equal = FALSE; - foreach ($team as $key => $value) { - if (!isset($template[$key])) { - continue; + foreach ($template as $key => $value) { + if ((string)$team[$key] !== (string)$template[$key]) { + return FALSE; } - if ($template[$key] !== $team[$key]) { - $equal = FALSE; - break; - } - $equal = TRUE; } - return $equal; + return TRUE; } // Return true if team exists, false if not