diff options
Diffstat (limited to 'src/Model/Entity/Log.php')
| -rw-r--r-- | src/Model/Entity/Log.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/Model/Entity/Log.php b/src/Model/Entity/Log.php new file mode 100644 index 0000000..b1cc168 --- /dev/null +++ b/src/Model/Entity/Log.php | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | <?php | ||
| 2 | // src/Model/Entity/Log.php | ||
| 3 | |||
| 4 | declare(strict_types=1); | ||
| 5 | |||
| 6 | namespace App\Entity; | ||
| 7 | |||
| 8 | use Doctrine\ORM\Mapping as ORM; | ||
| 9 | |||
| 10 | #[ORM\Entity] | ||
| 11 | #[ORM\Table(name: TABLE_PREFIX . "log")] | ||
| 12 | class Log | ||
| 13 | { | ||
| 14 | #[ORM\Id] | ||
| 15 | #[ORM\GeneratedValue] | ||
| 16 | #[ORM\Column(type: "integer")] | ||
| 17 | private int $id_log; | ||
| 18 | |||
| 19 | #[ORM\Column(type: 'datetime', options: ['default' => 'CURRENT_TIMESTAMP'])] // CURRENT_TIMESTAMP "inutile", date générée par PHP | ||
| 20 | private \DateTime $date_time; // type datetime de doctrine <=> type \DateTime de PHP | ||
| 21 | |||
| 22 | #[ORM\Column(type: "boolean")] | ||
| 23 | private bool $success; | ||
| 24 | |||
| 25 | public function __construct(bool $success){ | ||
| 26 | $this->date_time = new \DateTime; | ||
| 27 | $this->success = $success; | ||
| 28 | } | ||
| 29 | |||
| 30 | public function getFormatedDate(): string | ||
| 31 | { | ||
| 32 | return $this->date_time->format('d/m/Y à H\hi'); | ||
| 33 | } | ||
| 34 | public function getSuccess(): bool | ||
| 35 | { | ||
| 36 | return $this->success; | ||
| 37 | } | ||
| 38 | } | ||
