46 lines
861 B
PHP
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);
|
|
}
|
|
} |