pull/16/head
parent
947cda494a
commit
f9eb6fbb6d
@ -0,0 +1,3 @@
|
|||||||
|
@startuml
|
||||||
|
/*todo*/
|
||||||
|
@enduml
|
@ -1,8 +1,14 @@
|
|||||||
|
|
||||||
-- drop tables here
|
-- drop tables here
|
||||||
DROP TABLE IF EXISTS FormEntries;
|
DROP TABLE IF EXISTS FormEntries;
|
||||||
|
|
||||||
CREATE TABLE FormEntries(name varchar, description varchar);
|
CREATE TABLE FormEntries(name varchar, description varchar);
|
||||||
|
|
||||||
|
CREATE TABLE Team(
|
||||||
|
id numeric PRIMARY KEY AUTOINCREMENT,
|
||||||
|
name varchar,
|
||||||
|
picture varchar,
|
||||||
|
mainColor varchar,
|
||||||
|
secondColor varchar
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
class FrontController
|
||||||
|
{
|
||||||
|
/* todo */
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
use App\Model\TeamModel;
|
||||||
|
|
||||||
|
class TeamController /* verif si les camp sont assignés, sinon erreur 400*/
|
||||||
|
{
|
||||||
|
private TeamModel $model;
|
||||||
|
private Environment $twig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param TeamModel $model
|
||||||
|
* @param Environment $twig
|
||||||
|
*/
|
||||||
|
public function __construct(TeamModel $model, Environment $twig)
|
||||||
|
{
|
||||||
|
$this->model = $model;
|
||||||
|
$this->twig = $twig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function submitTeam(array $request){
|
||||||
|
if(isset($request['name']) && isset($request["picture"]) && isset($request["mainColor"]) && isset($request["secondColor"])){
|
||||||
|
$result= $this->$model->;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
http_response_code(400);
|
||||||
|
echo "Champ(s) manquant(s)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Gateway;
|
||||||
|
use App\Connexion;
|
||||||
|
|
||||||
|
class TeamGateway /* retourne exception par rapport à la validité du paramètre par ex. un int qui ne peut pas etre <0 doit etre verif etsoulever une exception */
|
||||||
|
{
|
||||||
|
private Connexion $con;
|
||||||
|
|
||||||
|
public function __construct(Connexion $con) {
|
||||||
|
$this->con = $con;
|
||||||
|
}
|
||||||
|
|
||||||
|
function insert(string $name, string $picture, string $mainColor, string $secondColor) {
|
||||||
|
$this->con->exec( /* todo */
|
||||||
|
"INSERT INTO Team VALUES (:name, :picture)",
|
||||||
|
[
|
||||||
|
":name" => [$username, PDO::PARAM_STR],
|
||||||
|
"description" => [$description, PDO::PARAM_STR]
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Model;
|
||||||
|
|
||||||
|
use App\Data\Color;
|
||||||
|
use App\Gateway\TeamGateway;
|
||||||
|
|
||||||
|
class TeamModel /* throw des exceptions(ex validation des champs, filtre etc) pour le controller qui l'utilise, catch celle de la gw, */
|
||||||
|
{
|
||||||
|
private TeamGateway $gateway;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param TeamGateway $gateway
|
||||||
|
*/
|
||||||
|
public function __construct(TeamGateway $gateway)
|
||||||
|
{
|
||||||
|
$this->gateway = $gateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function createTeam(string $name, Color $mainColor, Color $secondColor ){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue