Commit 60e0216a authored by SASSU Thomas's avatar SASSU Thomas
Browse files

fonction eloquent et etc

parent 0dd30a37
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "58ad4665ea57037daa2176094db2d412",
"content-hash": "cc18e66e95cadfdfa2cb91becd1b4524",
"packages": [
{
"name": "doctrine/inflector",
......@@ -220,6 +220,50 @@
],
"time": "2018-09-23T18:58:54+00:00"
},
{
"name": "illuminate/pagination",
"version": "v5.5.44",
"source": {
"type": "git",
"url": "https://github.com/illuminate/pagination.git",
"reference": "686b121987164d161fe3440f407014ad026bdbbc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/pagination/zipball/686b121987164d161fe3440f407014ad026bdbbc",
"reference": "686b121987164d161fe3440f407014ad026bdbbc",
"shasum": ""
},
"require": {
"illuminate/contracts": "5.5.*",
"illuminate/support": "5.5.*",
"php": ">=7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.5-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Pagination\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Pagination package.",
"homepage": "https://laravel.com",
"time": "2017-10-13T15:07:13+00:00"
},
{
"name": "illuminate/support",
"version": "v5.5.44",
......@@ -529,16 +573,16 @@
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.13.1",
"version": "v1.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f"
"reference": "34094cfa9abe1f0f14f48f490772db7a775559f2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f",
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2",
"reference": "34094cfa9abe1f0f14f48f490772db7a775559f2",
"shasum": ""
},
"require": {
......@@ -550,7 +594,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.13-dev"
"dev-master": "1.14-dev"
}
},
"autoload": {
......@@ -584,20 +628,20 @@
"portable",
"shim"
],
"time": "2019-11-27T14:18:11+00:00"
"time": "2020-01-13T11:15:53+00:00"
},
{
"name": "symfony/translation",
"version": "v4.4.3",
"version": "v4.4.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "f5d2ac46930238b30a9c2f1b17c905f3697d808c"
"reference": "0a19a77fba20818a969ef03fdaf1602de0546353"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/f5d2ac46930238b30a9c2f1b17c905f3697d808c",
"reference": "f5d2ac46930238b30a9c2f1b17c905f3697d808c",
"url": "https://api.github.com/repos/symfony/translation/zipball/0a19a77fba20818a969ef03fdaf1602de0546353",
"reference": "0a19a77fba20818a969ef03fdaf1602de0546353",
"shasum": ""
},
"require": {
......@@ -660,7 +704,7 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2020-01-15T13:29:06+00:00"
"time": "2020-02-04T09:32:40+00:00"
},
{
"name": "symfony/translation-contracts",
......
......@@ -3,9 +3,11 @@ require_once __DIR__ . '/vendor/autoload.php';
session_start();
use \Slim\Slim as Slim;
use Illuminate\Database\Capsule\Manager as DB;
use \gp\controleurs\ControleurPrincipal as ControleurPrincipal;
use \gp\controleurs\ControleurScript as ControleurScript;
$db = new DB();
$db->addConnection(parse_ini_file('./src/conf/conf.ini'));
$db->addConnection(parse_ini_file('./conf/conf.ini'));
$db->setAsGlobal();
$db->bootEloquent();
......@@ -13,169 +15,15 @@ $db->bootEloquent();
$app = new \Slim\Slim();
$app->get('/',function () {
$c = new \fridgie\controleurs\ControleurPrincipal();
$c->afficherAccueil();
$c = new ControleurPrincipal();
// $c->afficherAccueil();
});
/*
* ----------------------------------------------------------------
* Controleur Recette
* ----------------------------------------------------------------
*/
$app->get('/indexrecette', function() {
$c = new \fridgie\controleurs\ControleurRecette();
$c->indexRecette();
});
$app->get('/recette',function () {
$c = new \fridgie\controleurs\ControleurRecette();
$c->getRecette();
});
$app->post('/recette',function () {
$c = new \fridgie\controleurs\ControleurRecette();
$c->afficherRecette();
});
$app->get('/afficherrecette/:id',function ($id) {
$c = new \fridgie\controleurs\ControleurRecette();
$c->afficherRecetteId($id);
});
$app->get('/nouvellerecette', function() {
$c = new \fridgie\controleurs\ControleurRecette();
$c->formulaireInsererRecette();
});
$app->post('/nouvellerecette', function() {
$c = new \fridgie\controleurs\ControleurRecette();
$c->traitementformulaireInsererRecette();
});
$app->get('/rechercherecette', function() {
$c = new \fridgie\controleurs\ControleurRecette();
$c->formulaireRechercheRecette();
});
$app->post('/rechercherecette', function() {
$c = new \fridgie\controleurs\ControleurRecette();
$c->traitementFormulaireRechercheRecette();
});
/*
* ----------------------------------------------------------------
* Controleur Evenement
* ----------------------------------------------------------------
*/
$app->get('/indexevenement', function() {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->indexEvenement();
});
$app->get('/creationevenement',function () {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->creerEvenement();
});
$app->post('/creationevenement',function () {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->creerEvenementPost();
});
$app->get('/afficherevenements', function() {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->afficherEvenements();
});
$app->get('/afficherevenement/:token',function ($token) {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->afficherEvenement($token);
$app->get('/script_TD1/',function () {
$c = new ControleurScript();
$c->td1();
});
//$app->get('/participerevenement/:token', function($token) {
// $c = new \fridgie\controleurs\ControleurEvenement();
// $c->participerEvenement($token);
//});
$app->post('/participerevenement/:token', function($token) {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->participerEvenementPost($token);
});
//par nom
$app->get('/rechercheevenement/:recherche',function ($recherche) {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->rechercheEvenement($recherche);
});
/*
* ----------------------------------------------------------------
* Controleur Ingredient
* ----------------------------------------------------------------
*/
$app->post('/apporteringredient/:token', function($token) { //token = token de l'event
$c = new \fridgie\controleurs\ControleurIngredient();
$c->apporterIngredient($token);
header('Location: ../afficherevenement/' . $token);
exit();
});
$app->get('/apporteringredient/:token', function($token) { //token = token de l'event
$c = new \fridgie\controleurs\ControleurIngredient();
$c->apporterIngredientForm($token);
});
$app->get('/ingredient/:id', function($id) { //id = id de l'ingredient à afficher
$c = new \fridgie\controleurs\ControleurIngredient();
$c->afficherIngredient($id);
});
/*
* ----------------------------------------------------------------
* Controleur Client
* ----------------------------------------------------------------
*/
$app->get('/inscription', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->creerCompte();
});
$app->post('/inscription', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->traitementInscription();
});
$app->get('/connexion', function() {
$c = new \fridgie\controleurs\ControleurClient();
if (isset($_SESSION['Connexion']) == true) {
header('Location: ./moncompte');
exit();
}
else $c->identification();
});
$app->post('/connexion', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->traitementIdentification();
});
$app->post('/deconnexion', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->deconnexion();
});
$app->get('/moncompte', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->afficherCompte();
});
$app->post('/suppression', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->delete();
});
$app->run();
\ No newline at end of file
<?php
require_once __DIR__ . '../vendor/autoload.php';
session_start();
use \Slim\Slim as Slim;
use Illuminate\Database\Capsule\Manager as DB;
use \gp\controleurs\ControleurPrincipal as ControleurPrincipal;
use \gp\controleurs\ControleurScript as ControleurScript;
$db = new DB();
$db->addConnection(parse_ini_file('./conf/conf.ini'));
$db->setAsGlobal();
$db->bootEloquent();
$c = new ControleurScript();
$c->td1();
<?php
namespace gp\controleurs;
use gp\modeles\Platform;
use gp\modeles\Game;
use gp\modeles\Company;
use gp\modeles\Deck;
class ControleurScript
{
public function td1(){
echo "script TD1";
$tab=null;
$tab[] = $this->gameByName('Mario')->get();
$tab[] = $this->CompanyByCountry('Japan')->get();
$tab[] = $this->platformByBase('10000000')->get();
$tab[] = Game::skip(21173)->take(442)->get();
$data = Game::simplePaginate(500);
$s = "<p>--------------------------------------------------------<br>".
"Jeu contenant dans leur nom 'Mario'<br>".
"--------------------------------------------------------</p>";
echo $s;
foreach ($tab[0] as $game){
echo ("<p>{$game->name}</p>");
}
$s= "<p>--------------------------------------------------------<br>".
"Compagnies installées au 'Japon'<br>".
"--------------------------------------------------------</p>";
echo $s;
foreach ($tab[1] as $company){
echo ("<p>{$company->name}</p>");
}
$s = "<p>--------------------------------------------------------<br>".
"Plateformes dont la base installée est >= 10 000 000<br>".
"--------------------------------------------------------</p>";
echo $s;
foreach ($tab[2] as $plat){
echo ("<p>{$plat->name}</p>");
}
$s = "<p>--------------------------------------------------------<br>".
"liste de 442 jeux à partir du 21173ème<br>".
"--------------------------------------------------------</p>";
echo $s;
foreach ($tab[3] as $game){
echo ("<p>{$game->name}</p>");
}
$s = "<p>--------------------------------------------------------<br>".
"liste des jeux en paginant (taille des pages : 500)<br>".
"--------------------------------------------------------</p>";
echo $s;
$res = "";
foreach ($data as $t){
$res = $res . "<p>$t->name</p>";
}
$res = "<div class=\"container\">
$res
</div>";
echo $res;
}
private function gameByName($name){
return Game::where("name", "like", "%{$name}%");
}
private function companyByCountry($country){
return Company::where("location_country", "like", "{$country}");
}
private function platformByBase($base){
return Platform::where("install_base", ">=", "{$base}");
}
}
\ No newline at end of file
......@@ -279,7 +279,7 @@ class ClassLoader
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
......@@ -377,11 +377,11 @@ class ClassLoader
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\';
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
$length = $this->prefixLengthsPsr4[$first][$search];
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
......
......@@ -6,12 +6,14 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'fridgie\\' => array($baseDir . '/src'),
'gp\\' => array($baseDir . '/src'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'),
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
'Illuminate\\Support\\' => array($vendorDir . '/illuminate/support'),
'Illuminate\\Pagination\\' => array($vendorDir . '/illuminate/pagination'),
'Illuminate\\Database\\' => array($vendorDir . '/illuminate/database'),
'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'),
'Illuminate\\Container\\' => array($vendorDir . '/illuminate/container'),
......
......@@ -12,13 +12,14 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5
);
public static $prefixLengthsPsr4 = array (
'f' =>
'g' =>
array (
'fridgie\\' => 8,
'gp\\' => 3,
),
'S' =>
array (
'Symfony\\Polyfill\\Mbstring\\' => 26,
'Symfony\\Contracts\\Translation\\' => 30,
'Symfony\\Component\\Translation\\' => 30,
),
'P' =>
......@@ -29,6 +30,7 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5
'I' =>
array (
'Illuminate\\Support\\' => 19,
'Illuminate\\Pagination\\' => 22,
'Illuminate\\Database\\' => 20,
'Illuminate\\Contracts\\' => 21,
'Illuminate\\Container\\' => 21,
......@@ -40,7 +42,7 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5
);
public static $prefixDirsPsr4 = array (
'fridgie\\' =>
'gp\\' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
......@@ -48,6 +50,10 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
),
'Symfony\\Contracts\\Translation\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/translation-contracts',
),
'Symfony\\Component\\Translation\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/translation',
......@@ -64,6 +70,10 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5
array (
0 => __DIR__ . '/..' . '/illuminate/support',
),
'Illuminate\\Pagination\\' =>
array (
0 => __DIR__ . '/..' . '/illuminate/pagination',
),
'Illuminate\\Database\\' =>
array (
0 => __DIR__ . '/..' . '/illuminate/database',
......
This diff is collapsed.
......@@ -13,7 +13,7 @@
{"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
],
"require": {
"php": "^7.0"
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^6.2"
......@@ -22,11 +22,11 @@
"psr-4": { "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" }
},
"autoload-dev": {
"psr-4": { "Doctrine\\Tests\\Common\\Inflector\\": "tests/Doctrine/Common/Inflector" }
"psr-4": { "Doctrine\\Tests\\Common\\Inflector\\": "tests/Doctrine/Tests/Common/Inflector" }
},
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
"dev-master": "1.3.x-dev"
}
}
}
......@@ -38,7 +38,7 @@ class Inflector
/**
* Plural inflector rules.
*
* @var array
* @var string[][]
*/
private static $plural = array(
'rules' => array(
......@@ -53,6 +53,7 @@ class Inflector
'/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
'/sis$/i' => 'ses',
'/([ti])um$/i' => '\1a',
'/(c)riterion$/i' => '\1riteria',
'/(p)erson$/i' => '\1eople',
'/(m)an$/i' => '\1en',
'/(c)hild$/i' => '\1hildren',
......@@ -84,6 +85,7 @@ class Inflector
'beef' => 'beefs',
'brother' => 'brothers',
'cafe' => 'cafes',
'canvas' => 'canvases',
'chateau' => 'chateaux',
'niveau' => 'niveaux',
'child' => 'children',
......@@ -98,8 +100,10 @@ class Inflector
'foot' => 'feet',
'fungus' => 'fungi',
'ganglion' => 'ganglions',
'gas' => 'gases',
'genie' => 'genies',
'genus' => 'genera',
'goose' => 'geese',
'graffito' => 'graffiti',
'hippopotamus' => 'hippopotami',
'hoof' => 'hoofs',
......@@ -138,6 +142,7 @@ class Inflector
'tornado' => 'tornadoes',
'trilby' => 'trilbys',
'turf' => 'turfs',
'valve' => 'valves',
'volcano' => 'volcanoes',
)
);
......@@ -145,7 +150,7 @@ class Inflector
/**
* Singular inflector rules.
*
* @var array
* @var string[][]
*/
private static $singular = array(
'rules' => array(
......@@ -174,9 +179,11 @@ class Inflector
'/(hive)s$/i' => '\1',
'/(drive)s$/i' => '\1',
'/(dive)s$/i' => '\1',
'/(olive)s$/i' => '\1',
'/([^fo])ves$/i' => '\1fe',
'/(^analy)ses$/i' => '\1sis',
'/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
'/(c)riteria$/i' => '\1riterion',
'/([ti])a$/i' => '\1um',
'/(p)eople$/i' => '\1\2erson',
'/(m)en$/i' => '\1an',
......@@ -196,21 +203,27 @@ class Inflector
'.*pox',
'.*sheep',
'.*ss',
'data',
'police',
'pants',
'clothes',
),
'irregular' => array(
'abuses' => 'abuse',
'avalanches' => 'avalanche',
'caches' => 'cache',
'criteria' => 'criterion',
'curves' => 'curve',
'emphases' => 'emphasis',
'foes' => 'foe',
'geese' => 'goose',
'graves' => 'grave',
'hoaxes' => 'hoax',
'media' => 'medium',
'neuroses' => 'neurosis',
'waves' => 'wave',
'oases' => 'oasis',
'valves' => 'valve',
)