|
|
|
@ -29,10 +29,11 @@ class TeamController /* verif si les camp sont assignés, sinon erreur 400*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function submitTeam(array $request): HttpResponse {
|
|
|
|
|
$request['mainColor'] = intval($request['mainColor']);
|
|
|
|
|
$request['secondColor'] = intval($request['secondColor']);
|
|
|
|
|
var_dump($request['secondColor']);
|
|
|
|
|
|
|
|
|
|
$errors = [];
|
|
|
|
|
$request['mainColor'] = hexdec($request['mainColor']);
|
|
|
|
|
$request['secondColor'] = hexdec($request['secondColor']);
|
|
|
|
|
|
|
|
|
|
$request = HttpRequest::from($request, $errors, [
|
|
|
|
|
"name" => [Validators::lenBetween(1, 32), Validators::nameWithSpaces()],
|
|
|
|
|
"mainColor" => [Validators::isInteger(), Validators::isIntInRange(0, 0xffffff)],
|
|
|
|
@ -48,8 +49,7 @@ class TeamController /* verif si les camp sont assignés, sinon erreur 400*/
|
|
|
|
|
}
|
|
|
|
|
return ViewHttpResponse::twig('insert_team.html.twig', ['bad_fields' => $badFields]);
|
|
|
|
|
}
|
|
|
|
|
$id = $this->model->createTeam($request['name'], $request['picture'], $request['mainColor'], $request['secondColor']);
|
|
|
|
|
return $this->displayTeam($id);
|
|
|
|
|
return $this->displayTeam($this->model->createTeam($request['name'], $request['picture'], $request['mainColor'], $request['secondColor']));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function displayListTeamByName(): HttpResponse {
|
|
|
|
|