try athelte controller
continuous-integration/drone/push Build is failing Details

master
Antoine PINAGOT 1 year ago
parent a5b3648320
commit 225b4d58e8

@ -4,7 +4,7 @@ use Dotenv\Dotenv;
$dotenv = Dotenv::createImmutable(__DIR__); $dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->load(); $dotenv->load();
use Dotenv\Dotenv;
use Shared\Log; use Shared\Log;
$dotenv = Dotenv::createUnsafeImmutable(__DIR__,'.env'); $dotenv = Dotenv::createUnsafeImmutable(__DIR__,'.env');
@ -20,6 +20,6 @@ const DB_HOST = 'localhost';
const DB_DATABASE = 'heartTrack'; const DB_DATABASE = 'heartTrack';
const DB_USER = 'toto'; const DB_USER = 'toto';
const DB_PASSWORD = 'achanger'; const DB_PASSWORD = 'achanger';
const APP_ENV = 'console'; //const APP_ENV = 'console';
const DSN = "mysql:host=" . DB_HOST . ";dbname=" . DB_DATABASE; const DSN = "mysql:host=" . DB_HOST . ";dbname=" . DB_DATABASE;

@ -1,62 +1,63 @@
<?php <?php
// namespace App\Controller; namespace App\Controller;
// use App\Container; use App\Container;
// use App\Router\Request\IRequest; use App\Router\Request\IRequest;
// use App\Router\Response\Response; use App\Router\Response\Response;
// use Shared\Attributes\Route; use Shared\Attributes\Route;
// use Twig\Environment; use Twig\Environment;
// use Data\Core\Preferences; use Data\Core\Preferences;
// use Shared\Log; use Shared\Log;
// class AthleteController extends BaseController class AthleteController extends BaseController
// { {
// #[Route(path: '/search-user', name: 'search-user', methods: ['GET'])]
// public function searchUser(string $username, IRequest $req): Response
// {
// $taberror = [];
// $utiliArray = [
// [
// 'nom' => 'John',
// 'prenom' => 'Doe',
// 'img' => 'john_doe',
// 'username' => 'johndoe',
// ],
// [
// 'nom' => 'Alice',
// 'prenom' => 'Smith',
// 'img' => 'alice_smith',
// 'username' => 'alicesmith',
// ],
// ];
// // if(!Validation::val_string($name)){
// try {
// //code...
// // $model->userMgr->getUser($name);
// return $this->render('./page/addfriend.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => $utiliArray,
// 'infoUser' => [],
// 'exos' => [],
// 'member' => [],
// 'responce' => "Notification d'ajout envoyée à $username"
// ]);
// } catch (\Throwable $th) {
// //throw $th;
// // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
// }
// // }
#[Route(path: '/search-user', name: 'search-user', methods: ['GET'])]
public function searchUser(string $username, IRequest $req): Response
{
$taberror = [];
// FILTER
$utiliArray = [
[
'nom' => 'John',
'prenom' => 'Doe',
'img' => 'john_doe',
'username' => 'johndoe',
],
[
'nom' => 'Alice',
'prenom' => 'Smith',
'img' => 'alice_smith',
'username' => 'alicesmith',
],
];
// if(!Validation::val_string($name)){
try {
//code...
$model->userMgr->addFriend($username);
return $this->render('./page/addfriend.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => $utiliArray,
'infoUser' => [],
'exos' => [],
'member' => [],
'responce' => "Notification d'ajout envoyée à $username"
]);
} catch (\Throwable $th) {
//throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
}
// } // }
}
}
// #[Route(path: '/analyses', name: 'analyses', methods: ['GET'])] // #[Route(path: '/analyses', name: 'analyses', methods: ['GET'])]
// public function analyses(): Response // public function analyses(): Response
// { // {

@ -120,50 +120,50 @@ class Controller extends BaseController
]); ]);
} }
#[Route(path: '/search-user', name: 'search-user', methods: ['GET'])] // #[Route(path: '/search-user', name: 'search-user', methods: ['GET'])]
public function searchUser(string $username, IRequest $req): Response // public function searchUser(string $username, IRequest $req): Response
{ // {
$taberror = []; // $taberror = [];
// FILTER // // FILTER
$utiliArray = [ // $utiliArray = [
[ // [
'nom' => 'John', // 'nom' => 'John',
'prenom' => 'Doe', // 'prenom' => 'Doe',
'img' => 'john_doe', // 'img' => 'john_doe',
'username' => 'johndoe', // 'username' => 'johndoe',
], // ],
[ // [
'nom' => 'Alice', // 'nom' => 'Alice',
'prenom' => 'Smith', // 'prenom' => 'Smith',
'img' => 'alice_smith', // 'img' => 'alice_smith',
'username' => 'alicesmith', // 'username' => 'alicesmith',
], // ],
]; // ];
// if(!Validation::val_string($name)){ // // if(!Validation::val_string($name)){
try { // try {
//code... // //code...
// $model->userMgr->addFriend($name); // // $model->userMgr->addFriend($name);
return $this->render('./page/addfriend.html.twig',[ // return $this->render('./page/addfriend.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => $utiliArray, // 'users' => $utiliArray,
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [], // 'member' => [],
'responce' => "Notification d'ajout envoyée à $username" // 'responce' => "Notification d'ajout envoyée à $username"
]); // ]);
} catch (\Throwable $th) { // } catch (\Throwable $th) {
//throw $th; // //throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]); // // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
}
// } // }
// // }
} // }
#[Route(path: '/search-member', name: 'search-member', methods: ['GET'])] #[Route(path: '/search-member', name: 'search-member', methods: ['GET'])]
public function searchMember(string $username, IRequest $req): Response public function searchMember(string $username, IRequest $req): Response
@ -713,6 +713,3 @@ class Controller extends BaseController
} }
} }

Loading…
Cancel
Save