This commit is contained in:
marvin
2024-11-19 10:36:49 +01:00
parent 3abf0ff6c1
commit 1f803557aa
8 changed files with 19 additions and 99 deletions

View File

@@ -1,33 +0,0 @@
<?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 Version20241118134641 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 user (uuid BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL (email), PRIMARY KEY(uuid)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('DROP TABLE sortie');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE sortie (id INT AUTO_INCREMENT NOT NULL, id_sortie INT NOT NULL, nom VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, date_heure_debut DATE DEFAULT NULL, durée INT DEFAULT NULL, date_limite_inscription DATE DEFAULT NULL, nb_inscriptions_max INT DEFAULT NULL, infos_sortie VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, état INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('DROP TABLE user');
}
}

View File

@@ -1,31 +0,0 @@
<?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 Version20241118135534 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 user (uuid BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL (email), PRIMARY KEY(uuid)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE user');
}
}

View File

@@ -6,16 +6,15 @@ use App\Repository\EtatRepository;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: EtatRepository::class)] #[ORM\Entity(repositoryClass: EtatRepository::class)]
class Etat class Etat
{ {
#[ORM\Id] #[ORM\Id]
#[ORM\Column(type: 'uuid', unique: true)] #[ORM\Column(type: 'guid', unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')] #[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $idEtat = null; private ?string $idEtat = null;
#[ORM\Column(length: 255)] #[ORM\Column(length: 255)]
private ?string $libelle = null; private ?string $libelle = null;
@@ -28,11 +27,10 @@ class Etat
public function __construct() public function __construct()
{ {
$this->idEtat = Uuid::v4(); // Génération automatique d'un UUID
$this->sorties = new ArrayCollection(); $this->sorties = new ArrayCollection();
} }
public function getIdEtat(): ?Uuid public function getIdEtat(): ?string // Changement ici
{ {
return $this->idEtat; return $this->idEtat;
} }

View File

@@ -6,16 +6,15 @@ use App\Repository\LieuRepository;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: LieuRepository::class)] #[ORM\Entity(repositoryClass: LieuRepository::class)]
class Lieu class Lieu
{ {
#[ORM\Id] #[ORM\Id]
#[ORM\Column(type: 'uuid', unique: true)] #[ORM\Column(type: 'guid', unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')] #[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $idLieu = null; private ?string $idLieu = null;
#[ORM\Column(length: 255)] #[ORM\Column(length: 255)]
private ?string $nom = null; private ?string $nom = null;
@@ -41,11 +40,10 @@ class Lieu
public function __construct() public function __construct()
{ {
$this->idLieu = Uuid::v4(); // Génération automatique d'un UUID
$this->sorties = new ArrayCollection(); $this->sorties = new ArrayCollection();
} }
public function getIdLieu(): ?Uuid public function getIdLieu(): ?string
{ {
return $this->idLieu; return $this->idLieu;
} }

View File

@@ -6,16 +6,15 @@ use App\Repository\ParticipantRepository;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: ParticipantRepository::class)] #[ORM\Entity(repositoryClass: ParticipantRepository::class)]
class Participant class Participant
{ {
#[ORM\Id] #[ORM\Id]
#[ORM\Column(type: 'uuid', unique: true)] #[ORM\Column(type: 'guid', unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')] #[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $idParticipant = null; private ?string $idParticipant = null;
#[ORM\Column(length: 255)] #[ORM\Column(length: 255)]
private ?string $nom = null; private ?string $nom = null;
@@ -53,11 +52,10 @@ class Participant
public function __construct() public function __construct()
{ {
$this->idParticipant = Uuid::v4(); // Génération automatique de l'UUID
$this->sorties = new ArrayCollection(); $this->sorties = new ArrayCollection();
} }
public function getIdParticipant(): ?Uuid public function getIdParticipant(): ?string
{ {
return $this->idParticipant; return $this->idParticipant;
} }
@@ -137,7 +135,7 @@ class Participant
public function getRoles(): array public function getRoles(): array
{ {
$roles = $this->roles; $roles = $this->roles;
// Garantit que chaque utilisateur a au moins le rôle ROLE_USER // Garantir que chaque utilisateur a au moins le rôle ROLE_USER
$roles[] = 'ROLE_USER'; $roles[] = 'ROLE_USER';
return array_unique($roles); return array_unique($roles);

View File

@@ -6,16 +6,15 @@ use App\Repository\SiteRepository;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: SiteRepository::class)] #[ORM\Entity(repositoryClass: SiteRepository::class)]
class Site class Site
{ {
#[ORM\Id] #[ORM\Id]
#[ORM\Column(type: 'uuid', unique: true)] #[ORM\Column(type: 'guid', unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')] #[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $idSite = null; private ?string $idSite = null;
#[ORM\Column(length: 255)] #[ORM\Column(length: 255)]
private ?string $nom = null; private ?string $nom = null;
@@ -34,12 +33,11 @@ class Site
public function __construct() public function __construct()
{ {
$this->idSite = Uuid::v4();
$this->sorties = new ArrayCollection(); $this->sorties = new ArrayCollection();
$this->participants = new ArrayCollection(); $this->participants = new ArrayCollection();
} }
public function getIdSite(): ?Uuid public function getIdSite(): ?string
{ {
return $this->idSite; return $this->idSite;
} }

View File

@@ -5,16 +5,15 @@ namespace App\Entity;
use App\Repository\SortieRepository; use App\Repository\SortieRepository;
use Doctrine\DBAL\Types\Types; use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: SortieRepository::class)] #[ORM\Entity(repositoryClass: SortieRepository::class)]
class Sortie class Sortie
{ {
#[ORM\Id] #[ORM\Id]
#[ORM\Column(type: 'uuid', unique: true)] #[ORM\Column(type: 'guid', unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')] #[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $idSortie = null; private ?string $idSortie = null;
#[ORM\Column(length: 255)] #[ORM\Column(length: 255)]
private ?string $nom = null; private ?string $nom = null;
@@ -50,12 +49,7 @@ class Sortie
#[ORM\JoinColumn(name: 'etat_id', referencedColumnName: 'idEtat', nullable: false)] #[ORM\JoinColumn(name: 'etat_id', referencedColumnName: 'idEtat', nullable: false)]
private ?Etat $etat = null; private ?Etat $etat = null;
public function __construct() public function getIdSortie(): ?string
{
$this->idSortie = Uuid::v4();
}
public function getIdSortie(): ?Uuid
{ {
return $this->idSortie; return $this->idSortie;
} }

View File

@@ -6,16 +6,15 @@ use App\Repository\VilleRepository;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: VilleRepository::class)] #[ORM\Entity(repositoryClass: VilleRepository::class)]
class Ville class Ville
{ {
#[ORM\Id] #[ORM\Id]
#[ORM\Column(type: 'uuid', unique: true)] #[ORM\Column(type: 'guid', unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')] #[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $idVille = null; private ?string $idVille = null;
#[ORM\Column(length: 255)] #[ORM\Column(length: 255)]
private ?string $nom = null; private ?string $nom = null;
@@ -31,11 +30,10 @@ class Ville
public function __construct() public function __construct()
{ {
$this->idVille = Uuid::v4(); // Génération automatique d'un UUID
$this->lieux = new ArrayCollection(); $this->lieux = new ArrayCollection();
} }
public function getIdVille(): ?Uuid public function getIdVille(): ?string
{ {
return $this->idVille; return $this->idVille;
} }