dbh = $database->conn; $this->teamMapper = new TeamMapper($this->dbh); } /** * Returns TRUE if team exists, FALSE if not */ public function recieve(string $cardnumber): bool { $team = $this->teamMapper->getByCardnumber($cardnumber); if ($team) { // team exists, insert into time table $sth = $this->dbh->prepare('INSERT INTO tidtabell (LagID) VALUES (?)'); $sth->execute([$team->id]); return TRUE; } // team does not exist, lets create it $team = new Team; $team->cardnumber = $cardnumber; $this->teamMapper->create($team); return FALSE; } }