aboutsummaryrefslogtreecommitdiff
path: root/src/model/entities/Log.php
blob: 222b8dbe7dd438c8a60ebcc7613fcc53a62436c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
// src/model/entities/Log.php

declare(strict_types=1);

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
#[ORM\Table(name: TABLE_PREFIX . "log")]
class Log
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column(type: "integer")]
    private int $id_log;

    #[ORM\Column(type: 'datetime', options: ['default' => 'CURRENT_TIMESTAMP'])] // CURRENT_TIMESTAMP "inutile", date générée par PHP
    private \DateTime $date_time; // type datetime de doctrine <=> type \DateTime de PHP

    #[ORM\Column(type: "boolean")]
    private bool $success;

    public function __construct(bool $success){
        $this->date_time = new \DateTime;
        $this->success = $success;
    }

    public function getFormatedDate(): string
    {
        return $this->date_time->format('d/m/Y à H\hi');
    }
    public function getSuccess(): bool
    {
        return $this->success;
    }
}