diff options
Diffstat (limited to 'src/model/entities/Presentation.php')
-rw-r--r-- | src/model/entities/Presentation.php | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/model/entities/Presentation.php b/src/model/entities/Presentation.php deleted file mode 100644 index 6ada565..0000000 --- a/src/model/entities/Presentation.php +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | <?php | ||
2 | // src/model/entities/Presentation.php | ||
3 | |||
4 | declare(strict_types=1); | ||
5 | |||
6 | namespace App\Entity; | ||
7 | |||
8 | use Doctrine\ORM\EntityManager; | ||
9 | use Doctrine\ORM\Mapping as ORM; | ||
10 | |||
11 | #[ORM\Entity] | ||
12 | #[ORM\Table(name: TABLE_PREFIX . "presentation")] | ||
13 | class Presentation | ||
14 | { | ||
15 | static public array $option_list = ['fullwidth' => 'Pleine largeur', 'grid' => 'Grille', 'mosaic' => 'Mosaïque', 'carousel' => 'Carrousel']; | ||
16 | |||
17 | #[ORM\Id] | ||
18 | #[ORM\GeneratedValue] | ||
19 | #[ORM\Column(type: "integer")] | ||
20 | private int $id_presentation; | ||
21 | |||
22 | #[ORM\Column(type: "string", length: 255)] | ||
23 | private string $name; | ||
24 | |||
25 | public function __construct(string $name) | ||
26 | { | ||
27 | $this->name = array_keys(self::$option_list)[0]; // = fullwidth, sécurité option inconnue | ||
28 | foreach(self::$option_list as $key => $value){ | ||
29 | if($name === $key){ | ||
30 | $this->name = $name; | ||
31 | } | ||
32 | } | ||
33 | } | ||
34 | |||
35 | public function getName(): string | ||
36 | { | ||
37 | return $this->name; | ||
38 | } | ||
39 | |||
40 | static public function findPresentation(EntityManager $entityManager, string $name): ?self | ||
41 | { | ||
42 | return $entityManager | ||
43 | ->createQuery('SELECT p FROM App\Entity\Presentation p WHERE p.name = :name') | ||
44 | ->setParameter('name', $name) | ||
45 | ->getOneOrNullResult(); | ||
46 | } | ||
47 | } \ No newline at end of file | ||