WIP made a diagram class For team within MVC, players aren't incorporated yet
continuous-integration/drone/push Build is passing Details

pull/16/head
Maël DAIM 1 year ago
parent d08defaf65
commit 6ff667e3b8

@ -1,3 +1,68 @@
@startuml
/*todo*/
class Team {
- name: String
- picture: Url
- members: array<int, MemberRole>
+ getName(): String
+ getPicture(): Url
+ getMainColor(): Color
+ getSecondColor(): Color
+ listMembers(): array<Member>
}
Team --> "- mainColor" Color
Team --> "- secondaryColor" Color
class Color {
- value: int
+ getValue(): int
}
class TeamGateway{
--
+ __construct(con : Connexion)
+ insert(name : string ,picture : string, mainColor : Color, secondColor : Color)
+ listByName(name : string): array
}
TeamGateway *--"- con" Connexion
TeamGateway ..> Color
class TeamModel{
+ ERROR_INVALID_COLOR : int {readOnly}
+ ERROR_INVALID_NAME : int {readOnly}
+ ERROR_INVALID_PICTURE : int {readOnly}
+ ERROR_INVALID_SEARCH : int {readOnly}
+ ERROR_NO_DATA_FOUND : int {readOnly}
---
+ __construct(gateway : TeamGateway)
+ createTeam(name : string,picture : string, mainColorValue : int, secondColorValue : int, errors : array)
+ listByName(name : string ,errors : array) : ?array
}
TeamModel *--"- gateway" TeamGateway
TeamModel ..> Team
TeamModel ..> Color
class TeamController{
- twig : Environement
--
+ __construct( model : TeamModel, twig : Environement)
+ submitTeam(request : array)
+ listTeamByName(request : array)
}
TeamController *--"- model" TeamModel
class Connexion{
- pdo : PDO
--
+ __constructor(pdo : PDO)
+ exec(query : string, args : array)
+ fetch(query string, args array): array
}
@enduml

@ -40,7 +40,7 @@ $router->map("POST", "/submit", fn() => $sampleFormController->submitForm($_POST
$router->map("GET", "/twig", fn() => $sampleFormController->displayFormTwig());
$router->map("POST", "/submit-twig", fn() => $sampleFormController->submitFormTwig($_POST));
$teamController = new \App\Controller\TeamController(new \App\Model\TeamModel(),$twig);
$teamController = new \App\Controller\TeamController(new \App\Model\TeamModel(new \App\Gateway\TeamGateway($con)),$twig);
$router->map("GET","/team/new", fn()=>$teamController->submitTeam($_POST));
$match = $router->match();

@ -28,7 +28,7 @@ class TeamController /* verif si les camp sont assignés, sinon erreur 400*/
public function listTeamByName(array $request){
$errors = [];
$this->model->listByName($request['name'],$errors);
$results = $this->model->listByName($request['name'],$errors);
if(!empty($errors)){
/*todo appelle vue avec param*/
}

@ -26,7 +26,7 @@ class TeamGateway /* retourne exception par rapport à la validité du paramètr
);
}
public function listByName($name): array {
public function listByName(string $name): array {
return $this->con->fetch(
"SELECT name,picture,mainColor,secondColor FROM Team WHERE name LIKE '% :thing %' ",
[

@ -10,7 +10,7 @@ class TeamModel /* throw des exceptions(ex validation des champs, filtre etc) po
{
/**
* Attributes used to
* Attributes used to handle errors
*/
public const ERROR_INVALID_COLOR = 0;
public const ERROR_INVALID_NAME = 1;

@ -55,9 +55,6 @@
</head>
<body>
<div class="container">
<h2>Créer une équipe</h2>
<form action="/team/new" method="post">

Loading…
Cancel
Save