entité sortie

This commit is contained in:
marvin
2024-11-18 14:53:09 +01:00
parent d886888d8c
commit a07fb89eef
2 changed files with 192 additions and 0 deletions

149
src/Entity/Sortie.php Normal file
View File

@@ -0,0 +1,149 @@
<?php
namespace App\Entity;
use App\Repository\SortieRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: SortieRepository::class)]
class Sortie
{
#[ORM\Id]
#[ORM\Column(type: UuidType::NAME, unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $idSortie;
#[ORM\Column(length: 255)]
private ?string $nom = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $dateHeureDebut = null;
#[ORM\Column(nullable: true)]
private ?int $durée = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $dateLimiteInscription = null;
#[ORM\Column(nullable: true)]
private ?int $nbInscriptionsMax = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $infosSortie = null;
#[ORM\Column(nullable: true)]
private ?int $état = null;
public function __construct()
{
// Génère un UUID automatiquement lors de la création de l'entité
$this->id = Uuid::v4();
}
public function getId(): ?Uuid
{
return $this->id;
}
public function getIdSortie(): ?int
{
return $this->idSortie;
}
public function setIdSortie(int $idSortie): static
{
$this->idSortie = $idSortie;
return $this;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): static
{
$this->nom = $nom;
return $this;
}
public function getDateHeureDebut(): ?\DateTimeInterface
{
return $this->dateHeureDebut;
}
public function setDateHeureDebut(?\DateTimeInterface $dateHeureDebut): static
{
$this->dateHeureDebut = $dateHeureDebut;
return $this;
}
public function getDurée(): ?int
{
return $this->durée;
}
public function setDurée(?int $durée): static
{
$this->durée = $durée;
return $this;
}
public function getDateLimiteInscription(): ?\DateTimeInterface
{
return $this->dateLimiteInscription;
}
public function setDateLimiteInscription(?\DateTimeInterface $dateLimiteInscription): static
{
$this->dateLimiteInscription = $dateLimiteInscription;
return $this;
}
public function getNbInscriptionsMax(): ?int
{
return $this->nbInscriptionsMax;
}
public function setNbInscriptionsMax(?int $nbInscriptionsMax): static
{
$this->nbInscriptionsMax = $nbInscriptionsMax;
return $this;
}
public function getInfosSortie(): ?string
{
return $this->infosSortie;
}
public function setInfosSortie(?string $infosSortie): static
{
$this->infosSortie = $infosSortie;
return $this;
}
public function getétat(): ?int
{
return $this->état;
}
public function setétat(?int $état): static
{
$this->état = $état;
return $this;
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Sortie;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Sortie>
*/
class SortieRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Sortie::class);
}
// /**
// * @return Sortie[] Returns an array of Sortie objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('s.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Sortie
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}