This repository has been archived on 2023-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
web/app/model/Teamtable.php
2022-03-13 20:54:34 +01:00

46 lines
861 B
PHP

<?php
use App\Core\Database;
use App\Teamtable\Team;
use App\Teamtable\TeamMapper;
/**
* Does stuffs with the teamtable
*/
class Teamtable
{
public PDO $dbh;
public TeamMapper $teamMapper;
public function __construct(Database $database)
{
$this->dbh = $database->conn;
$this->teamMapper = new TeamMapper($this->dbh);
}
public function getAll(): array
{
return $this->teamMapper->getAll();
}
public function get(int $id): ?Team
{
return $this->teamMapper->get($id);
}
public function create(Team $team): Team
{
return $this->teamMapper->create($team);
}
public function delete(int $id): void
{
$this->teamMapper->delete($id);
}
public function update(Team $team): Team
{
return $this->teamMapper->update($team);
}
}