Browse Source

fichiers oubliés

garthh 1 week ago
parent
commit
d94e0501d6
3 changed files with 197 additions and 0 deletions
  1. 125 0
      migrations/Version20250821153615.php
  2. 31 0
      migrations/Version20250822104852.php
  3. 41 0
      src/Enum/AgeRange.php

+ 125 - 0
migrations/Version20250821153615.php

@@ -0,0 +1,125 @@
+<?php
+
+declare(strict_types=1);
+
+namespace DoctrineMigrations;
+
+use Doctrine\DBAL\Schema\Schema;
+use Doctrine\Migrations\AbstractMigration;
+
+/**
+ * Auto-generated Migration: Please modify to your needs!
+ */
+final class Version20250821153615 extends AbstractMigration
+{
+    public function getDescription(): string
+    {
+        return '';
+    }
+
+    public function up(Schema $schema): void
+    {
+        // this up() migration is auto-generated, please modify it to your needs
+        $this->addSql('CREATE TABLE availability (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', event_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', gamemaster_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', period_id INT NOT NULL, start_on DATETIME NOT NULL, end_on DATETIME NOT NULL, available TINYINT(1) NOT NULL, INDEX IDX_3FB7A2BF71F7E88B (event_id), INDEX IDX_3FB7A2BF96376157 (gamemaster_id), INDEX IDX_3FB7A2BFEC8B7ADE (period_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE event (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, picture VARCHAR(255) DEFAULT NULL, start_on DATETIME NOT NULL, end_on DATETIME NOT NULL, more_link VARCHAR(255) DEFAULT NULL, slug VARCHAR(255) DEFAULT NULL, published TINYINT(1) DEFAULT NULL, private TINYINT(1) DEFAULT NULL, hidden_planning TINYINT(1) DEFAULT NULL, everyone_can_ask_for_game TINYINT(1) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE event_gamemaster (event_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', gamemaster_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_CDECEFEA71F7E88B (event_id), INDEX IDX_CDECEFEA96376157 (gamemaster_id), PRIMARY KEY(event_id, gamemaster_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE event_game (event_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', game_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_3CE07D2771F7E88B (event_id), INDEX IDX_3CE07D27E48FD905 (game_id), PRIMARY KEY(event_id, game_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE game (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', add_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, is_physical TINYINT(1) DEFAULT NULL, is_numerical TINYINT(1) DEFAULT NULL, url_numerical_version VARCHAR(255) DEFAULT NULL, is_in_asso_library TINYINT(1) DEFAULT NULL, is_borrowed TINYINT(1) DEFAULT NULL, picture VARCHAR(255) DEFAULT NULL, add_datetime DATETIME DEFAULT NULL, is_valid_by_admin TINYINT(1) DEFAULT NULL, valid_datetime DATETIME DEFAULT NULL, INDEX IDX_232B318C17542AC5 (add_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE game_genre (game_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', genre_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_B1634A77E48FD905 (game_id), INDEX IDX_B1634A774296D31F (genre_id), PRIMARY KEY(game_id, genre_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE gamemaster (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', link_to_user_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', email VARCHAR(180) NOT NULL, first_name VARCHAR(180) DEFAULT NULL, last_name VARCHAR(180) DEFAULT NULL, prefered_name VARCHAR(180) DEFAULT NULL, description LONGTEXT DEFAULT NULL, phone VARCHAR(255) DEFAULT NULL, picture VARCHAR(255) DEFAULT NULL, slug VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_950236C57E7C2E95 (link_to_user_id), UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE gamemaster_game (gamemaster_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', game_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_85092B7096376157 (gamemaster_id), INDEX IDX_85092B70E48FD905 (game_id), PRIMARY KEY(gamemaster_id, game_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE genre (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', genre VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE participation (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', party_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', participant_name VARCHAR(255) NOT NULL, participant_email VARCHAR(255) NOT NULL, participant_phone VARCHAR(255) DEFAULT NULL, consent_mail TINYINT(1) DEFAULT NULL, consent_image TINYINT(1) DEFAULT NULL, checkin TINYINT(1) DEFAULT NULL, INDEX IDX_AB55E24F213C1059 (party_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE party (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', gamemaster_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', game_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', event_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', submitter_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', start_on DATETIME DEFAULT NULL, end_on DATETIME DEFAULT NULL, gamemaster_is_author TINYINT(1) DEFAULT NULL, min_participants INT DEFAULT NULL, max_participants INT DEFAULT NULL, description LONGTEXT DEFAULT NULL, submitted_date DATETIME DEFAULT NULL, validated TINYINT(1) DEFAULT NULL, INDEX IDX_89954EE096376157 (gamemaster_id), INDEX IDX_89954EE0E48FD905 (game_id), INDEX IDX_89954EE071F7E88B (event_id), INDEX IDX_89954EE0919E5513 (submitter_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE party_request (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', requester_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', moderator_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', game_choosen_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', gamemaster_choosen_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', event_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', date_request DATETIME NOT NULL, mod_on_date DATETIME DEFAULT NULL, accepted TINYINT(1) DEFAULT NULL, message LONGTEXT DEFAULT NULL, INDEX IDX_296610B4ED442CF4 (requester_id), INDEX IDX_296610B4D0AFA354 (moderator_id), INDEX IDX_296610B43A95A60F (game_choosen_id), INDEX IDX_296610B44B8771C4 (gamemaster_choosen_id), INDEX IDX_296610B471F7E88B (event_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE period (id INT AUTO_INCREMENT NOT NULL, event_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', start_on DATETIME NOT NULL, end_on DATETIME NOT NULL, locked TINYINT(1) DEFAULT NULL, INDEX IDX_C5B81ECE71F7E88B (event_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE reset_password_request (id INT AUTO_INCREMENT NOT NULL, user_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', selector VARCHAR(20) NOT NULL, hashed_token VARCHAR(100) NOT NULL, requested_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', expires_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_7CE748AA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE slot (id INT AUTO_INCREMENT NOT NULL, period_id INT NOT NULL, space_id INT NOT NULL, event_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', party_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', start_on DATETIME NOT NULL, end_on DATETIME NOT NULL, unavailable TINYINT(1) DEFAULT NULL, INDEX IDX_AC0E2067EC8B7ADE (period_id), INDEX IDX_AC0E206723575340 (space_id), INDEX IDX_AC0E206771F7E88B (event_id), INDEX IDX_AC0E2067213C1059 (party_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE space (id INT AUTO_INCREMENT NOT NULL, event_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(255) NOT NULL, locked TINYINT(1) DEFAULT NULL, INDEX IDX_2972C13A71F7E88B (event_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE user (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', email VARCHAR(180) NOT NULL, roles JSON NOT NULL COMMENT \'(DC2Type:json)\', password VARCHAR(255) NOT NULL, is_verified TINYINT(1) NOT NULL, first_name VARCHAR(180) NOT NULL, last_name VARCHAR(180) NOT NULL, phone VARCHAR(255) DEFAULT NULL, last_update DATETIME DEFAULT NULL, last_login DATETIME DEFAULT NULL, last_action DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT NOT NULL, headers LONGTEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', available_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', delivered_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
+        $this->addSql('ALTER TABLE availability ADD CONSTRAINT FK_3FB7A2BF71F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
+        $this->addSql('ALTER TABLE availability ADD CONSTRAINT FK_3FB7A2BF96376157 FOREIGN KEY (gamemaster_id) REFERENCES gamemaster (id)');
+        $this->addSql('ALTER TABLE availability ADD CONSTRAINT FK_3FB7A2BFEC8B7ADE FOREIGN KEY (period_id) REFERENCES period (id)');
+        $this->addSql('ALTER TABLE event_gamemaster ADD CONSTRAINT FK_CDECEFEA71F7E88B FOREIGN KEY (event_id) REFERENCES event (id) ON DELETE CASCADE');
+        $this->addSql('ALTER TABLE event_gamemaster ADD CONSTRAINT FK_CDECEFEA96376157 FOREIGN KEY (gamemaster_id) REFERENCES gamemaster (id) ON DELETE CASCADE');
+        $this->addSql('ALTER TABLE event_game ADD CONSTRAINT FK_3CE07D2771F7E88B FOREIGN KEY (event_id) REFERENCES event (id) ON DELETE CASCADE');
+        $this->addSql('ALTER TABLE event_game ADD CONSTRAINT FK_3CE07D27E48FD905 FOREIGN KEY (game_id) REFERENCES game (id) ON DELETE CASCADE');
+        $this->addSql('ALTER TABLE game ADD CONSTRAINT FK_232B318C17542AC5 FOREIGN KEY (add_by_id) REFERENCES user (id)');
+        $this->addSql('ALTER TABLE game_genre ADD CONSTRAINT FK_B1634A77E48FD905 FOREIGN KEY (game_id) REFERENCES game (id) ON DELETE CASCADE');
+        $this->addSql('ALTER TABLE game_genre ADD CONSTRAINT FK_B1634A774296D31F FOREIGN KEY (genre_id) REFERENCES genre (id) ON DELETE CASCADE');
+        $this->addSql('ALTER TABLE gamemaster ADD CONSTRAINT FK_950236C57E7C2E95 FOREIGN KEY (link_to_user_id) REFERENCES user (id)');
+        $this->addSql('ALTER TABLE gamemaster_game ADD CONSTRAINT FK_85092B7096376157 FOREIGN KEY (gamemaster_id) REFERENCES gamemaster (id) ON DELETE CASCADE');
+        $this->addSql('ALTER TABLE gamemaster_game ADD CONSTRAINT FK_85092B70E48FD905 FOREIGN KEY (game_id) REFERENCES game (id) ON DELETE CASCADE');
+        $this->addSql('ALTER TABLE participation ADD CONSTRAINT FK_AB55E24F213C1059 FOREIGN KEY (party_id) REFERENCES party (id)');
+        $this->addSql('ALTER TABLE party ADD CONSTRAINT FK_89954EE096376157 FOREIGN KEY (gamemaster_id) REFERENCES gamemaster (id)');
+        $this->addSql('ALTER TABLE party ADD CONSTRAINT FK_89954EE0E48FD905 FOREIGN KEY (game_id) REFERENCES game (id)');
+        $this->addSql('ALTER TABLE party ADD CONSTRAINT FK_89954EE071F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
+        $this->addSql('ALTER TABLE party ADD CONSTRAINT FK_89954EE0919E5513 FOREIGN KEY (submitter_id) REFERENCES user (id)');
+        $this->addSql('ALTER TABLE party_request ADD CONSTRAINT FK_296610B4ED442CF4 FOREIGN KEY (requester_id) REFERENCES user (id)');
+        $this->addSql('ALTER TABLE party_request ADD CONSTRAINT FK_296610B4D0AFA354 FOREIGN KEY (moderator_id) REFERENCES user (id)');
+        $this->addSql('ALTER TABLE party_request ADD CONSTRAINT FK_296610B43A95A60F FOREIGN KEY (game_choosen_id) REFERENCES game (id)');
+        $this->addSql('ALTER TABLE party_request ADD CONSTRAINT FK_296610B44B8771C4 FOREIGN KEY (gamemaster_choosen_id) REFERENCES gamemaster (id)');
+        $this->addSql('ALTER TABLE party_request ADD CONSTRAINT FK_296610B471F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
+        $this->addSql('ALTER TABLE period ADD CONSTRAINT FK_C5B81ECE71F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
+        $this->addSql('ALTER TABLE reset_password_request ADD CONSTRAINT FK_7CE748AA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
+        $this->addSql('ALTER TABLE slot ADD CONSTRAINT FK_AC0E2067EC8B7ADE FOREIGN KEY (period_id) REFERENCES period (id)');
+        $this->addSql('ALTER TABLE slot ADD CONSTRAINT FK_AC0E206723575340 FOREIGN KEY (space_id) REFERENCES space (id)');
+        $this->addSql('ALTER TABLE slot ADD CONSTRAINT FK_AC0E206771F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
+        $this->addSql('ALTER TABLE slot ADD CONSTRAINT FK_AC0E2067213C1059 FOREIGN KEY (party_id) REFERENCES party (id)');
+        $this->addSql('ALTER TABLE space ADD CONSTRAINT FK_2972C13A71F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
+    }
+
+    public function down(Schema $schema): void
+    {
+        // this down() migration is auto-generated, please modify it to your needs
+        $this->addSql('ALTER TABLE availability DROP FOREIGN KEY FK_3FB7A2BF71F7E88B');
+        $this->addSql('ALTER TABLE availability DROP FOREIGN KEY FK_3FB7A2BF96376157');
+        $this->addSql('ALTER TABLE availability DROP FOREIGN KEY FK_3FB7A2BFEC8B7ADE');
+        $this->addSql('ALTER TABLE event_gamemaster DROP FOREIGN KEY FK_CDECEFEA71F7E88B');
+        $this->addSql('ALTER TABLE event_gamemaster DROP FOREIGN KEY FK_CDECEFEA96376157');
+        $this->addSql('ALTER TABLE event_game DROP FOREIGN KEY FK_3CE07D2771F7E88B');
+        $this->addSql('ALTER TABLE event_game DROP FOREIGN KEY FK_3CE07D27E48FD905');
+        $this->addSql('ALTER TABLE game DROP FOREIGN KEY FK_232B318C17542AC5');
+        $this->addSql('ALTER TABLE game_genre DROP FOREIGN KEY FK_B1634A77E48FD905');
+        $this->addSql('ALTER TABLE game_genre DROP FOREIGN KEY FK_B1634A774296D31F');
+        $this->addSql('ALTER TABLE gamemaster DROP FOREIGN KEY FK_950236C57E7C2E95');
+        $this->addSql('ALTER TABLE gamemaster_game DROP FOREIGN KEY FK_85092B7096376157');
+        $this->addSql('ALTER TABLE gamemaster_game DROP FOREIGN KEY FK_85092B70E48FD905');
+        $this->addSql('ALTER TABLE participation DROP FOREIGN KEY FK_AB55E24F213C1059');
+        $this->addSql('ALTER TABLE party DROP FOREIGN KEY FK_89954EE096376157');
+        $this->addSql('ALTER TABLE party DROP FOREIGN KEY FK_89954EE0E48FD905');
+        $this->addSql('ALTER TABLE party DROP FOREIGN KEY FK_89954EE071F7E88B');
+        $this->addSql('ALTER TABLE party DROP FOREIGN KEY FK_89954EE0919E5513');
+        $this->addSql('ALTER TABLE party_request DROP FOREIGN KEY FK_296610B4ED442CF4');
+        $this->addSql('ALTER TABLE party_request DROP FOREIGN KEY FK_296610B4D0AFA354');
+        $this->addSql('ALTER TABLE party_request DROP FOREIGN KEY FK_296610B43A95A60F');
+        $this->addSql('ALTER TABLE party_request DROP FOREIGN KEY FK_296610B44B8771C4');
+        $this->addSql('ALTER TABLE party_request DROP FOREIGN KEY FK_296610B471F7E88B');
+        $this->addSql('ALTER TABLE period DROP FOREIGN KEY FK_C5B81ECE71F7E88B');
+        $this->addSql('ALTER TABLE reset_password_request DROP FOREIGN KEY FK_7CE748AA76ED395');
+        $this->addSql('ALTER TABLE slot DROP FOREIGN KEY FK_AC0E2067EC8B7ADE');
+        $this->addSql('ALTER TABLE slot DROP FOREIGN KEY FK_AC0E206723575340');
+        $this->addSql('ALTER TABLE slot DROP FOREIGN KEY FK_AC0E206771F7E88B');
+        $this->addSql('ALTER TABLE slot DROP FOREIGN KEY FK_AC0E2067213C1059');
+        $this->addSql('ALTER TABLE space DROP FOREIGN KEY FK_2972C13A71F7E88B');
+        $this->addSql('DROP TABLE availability');
+        $this->addSql('DROP TABLE event');
+        $this->addSql('DROP TABLE event_gamemaster');
+        $this->addSql('DROP TABLE event_game');
+        $this->addSql('DROP TABLE game');
+        $this->addSql('DROP TABLE game_genre');
+        $this->addSql('DROP TABLE gamemaster');
+        $this->addSql('DROP TABLE gamemaster_game');
+        $this->addSql('DROP TABLE genre');
+        $this->addSql('DROP TABLE participation');
+        $this->addSql('DROP TABLE party');
+        $this->addSql('DROP TABLE party_request');
+        $this->addSql('DROP TABLE period');
+        $this->addSql('DROP TABLE reset_password_request');
+        $this->addSql('DROP TABLE slot');
+        $this->addSql('DROP TABLE space');
+        $this->addSql('DROP TABLE user');
+        $this->addSql('DROP TABLE messenger_messages');
+    }
+}

+ 31 - 0
migrations/Version20250822104852.php

@@ -0,0 +1,31 @@
+<?php
+
+declare(strict_types=1);
+
+namespace DoctrineMigrations;
+
+use Doctrine\DBAL\Schema\Schema;
+use Doctrine\Migrations\AbstractMigration;
+
+/**
+ * Auto-generated Migration: Please modify to your needs!
+ */
+final class Version20250822104852 extends AbstractMigration
+{
+    public function getDescription(): string
+    {
+        return '';
+    }
+
+    public function up(Schema $schema): void
+    {
+        // this up() migration is auto-generated, please modify it to your needs
+        $this->addSql('ALTER TABLE game ADD age_recommendation VARCHAR(255) DEFAULT NULL');
+    }
+
+    public function down(Schema $schema): void
+    {
+        // this down() migration is auto-generated, please modify it to your needs
+        $this->addSql('ALTER TABLE game DROP age_recommendation');
+    }
+}

+ 41 - 0
src/Enum/AgeRange.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace App\Enum;
+
+enum AgeRange: string
+{
+    case YOUNG_CHILD = '4 à 8 ans';
+    case CHILD = '8 à 12 ans';
+    case TEEN = '12 à 16 ans';
+    case YOUNG_ADULT = '16 à 18 ans';
+    case ADULT = '18 ans et plus';
+    
+    public function label(): string
+    {
+        return match($this) {
+            self::YOUNG_CHILD => 'à partir de 4 ans',
+            self::CHILD => 'à partir de 8 ans',
+            self::TEEN => 'à partir de 12 ans',
+            self::YOUNG_ADULT => 'à partir de 16 ans',
+            self::ADULT => 'à partir de 18 ans'
+        };
+    }
+    public function shortLabel(): string
+    {
+        return match($this) {
+            self::YOUNG_CHILD => '4+',
+            self::CHILD => '8+',
+            self::TEEN => '12+',
+            self::YOUNG_ADULT => '16+',
+            self::ADULT => '18+'
+        };
+    }
+    public function prerequist(): string
+    {
+        return match($this) {
+            self::YOUNG_CHILD => 'S\'exprimer et compter jusqu\'à 6',
+            self::CHILD => 'Savoir lire, écrire et compter',
+            default => null
+        };
+    }
+}