|
|
@ -1,8 +1,11 @@
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace App\Model;
|
|
|
|
namespace App\Model;
|
|
|
|
use App\Data\Color;
|
|
|
|
|
|
|
|
use App\Gateway\TeamGateway;
|
|
|
|
use App\Gateway\TeamGateway;
|
|
|
|
use App\Data\Team;
|
|
|
|
use App\Data\Team;
|
|
|
|
|
|
|
|
use App\Data\Member;
|
|
|
|
|
|
|
|
use App\Data\MemberRole;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -14,8 +17,7 @@ class TeamModel /* throw des exceptions(ex validation des champs, filtre etc) po
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @param TeamGateway $gateway
|
|
|
|
* @param TeamGateway $gateway
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function __construct(TeamGateway $gateway)
|
|
|
|
public function __construct(TeamGateway $gateway) {
|
|
|
|
{
|
|
|
|
|
|
|
|
$this->gateway = $gateway;
|
|
|
|
$this->gateway = $gateway;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -32,9 +34,20 @@ class TeamModel /* throw des exceptions(ex validation des champs, filtre etc) po
|
|
|
|
return $teams;
|
|
|
|
return $teams;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function displayTeam(int $id): array{
|
|
|
|
public function displayTeam(int $id): Team {
|
|
|
|
$resultTeam = $this->gateway->getTeamById($id);
|
|
|
|
$members = [];
|
|
|
|
|
|
|
|
$result = $this->gateway->getTeamById($id);
|
|
|
|
$resultMembers = $this->gateway->getMembersById($id);
|
|
|
|
$resultMembers = $this->gateway->getMembersById($id);
|
|
|
|
|
|
|
|
foreach ($resultMembers as $row) {
|
|
|
|
|
|
|
|
if ($row['role'] == 'C') {
|
|
|
|
|
|
|
|
$role = 1;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$role = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$members[] = new Member($row['id'], $row['email'], $role);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$team = new Team($result['id'], $result['name'], $result['picture'], $result['mainColor'], $result['secondColor'], $members);
|
|
|
|
|
|
|
|
return $team;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|