Formatted with php-cs-fixer
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
/* -------------------------------------------------
|
/* -------------------------------------------------
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use RedBeanPHP\R;
|
use RedBeanPHP\R;
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Non utilisé pour l'instant
|
// Non utilisé pour l'instant
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
@@ -9,7 +10,7 @@ use RedBeanPHP\OODBBean;
|
|||||||
/**
|
/**
|
||||||
* Modèle RedBeanPHP minimal pour l'entité « post ».
|
* Modèle RedBeanPHP minimal pour l'entité « post ».
|
||||||
*
|
*
|
||||||
* Chaque instance encapsule un bean RedBean (`OODBBean`).
|
* Chaque instance encapsule un bean RedBean (`OODBBean`).
|
||||||
* Les opérations CRUD sont déléguées à RedBean, tandis que les
|
* Les opérations CRUD sont déléguées à RedBean, tandis que les
|
||||||
* getters/setters offrent une API typée.
|
* getters/setters offrent une API typée.
|
||||||
*/
|
*/
|
||||||
@@ -51,7 +52,7 @@ class Post
|
|||||||
public static function allDesc(): array
|
public static function allDesc(): array
|
||||||
{
|
{
|
||||||
$beans = R::findAll('post', ' ORDER BY id DESC ');
|
$beans = R::findAll('post', ' ORDER BY id DESC ');
|
||||||
return array_map(fn(OODBBean $b) => new self($b), $beans);
|
return array_map(fn (OODBBean $b) => new self($b), $beans);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------
|
/* -------------------------------------------------
|
||||||
@@ -74,12 +75,27 @@ class Post
|
|||||||
ACCESSEURS / MUTATEURS
|
ACCESSEURS / MUTATEURS
|
||||||
------------------------------------------------- */
|
------------------------------------------------- */
|
||||||
|
|
||||||
public function getId(): int { return (int) $this->bean->id; }
|
public function getId(): int
|
||||||
public function getTitle(): string { return (string) $this->bean->title; }
|
{
|
||||||
public function getContent(): string { return (string) $this->bean->content; }
|
return (int) $this->bean->id;
|
||||||
|
}
|
||||||
|
public function getTitle(): string
|
||||||
|
{
|
||||||
|
return (string) $this->bean->title;
|
||||||
|
}
|
||||||
|
public function getContent(): string
|
||||||
|
{
|
||||||
|
return (string) $this->bean->content;
|
||||||
|
}
|
||||||
|
|
||||||
public function setTitle(string $title): void { $this->bean->title = $title; }
|
public function setTitle(string $title): void
|
||||||
public function setContent(string $content): void { $this->bean->content = $content; }
|
{
|
||||||
|
$this->bean->title = $title;
|
||||||
|
}
|
||||||
|
public function setContent(string $content): void
|
||||||
|
{
|
||||||
|
$this->bean->content = $content;
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------
|
/* -------------------------------------------------
|
||||||
MISE À JOUR À PARTIR D'UN TABLEAU
|
MISE À JOUR À PARTIR D'UN TABLEAU
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Slim\App;
|
use Slim\App;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Slim\App;
|
use Slim\App;
|
||||||
@@ -12,6 +13,6 @@ use App\Controllers\PostController;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
return function (App $app): void {
|
return function (App $app): void {
|
||||||
// Page d'accueil – liste des articles
|
// Page d'accueil – liste des articles
|
||||||
$app->get('/', [PostController::class, 'index']);
|
$app->get('/', [PostController::class, 'index']);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user