src/Entity/Formations.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  4. use App\Repository\FormationsRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassFormationsRepository::class)]
  7. #[ORM\Table(name"formations")]
  8. #[UniqueEntity(
  9.     fields: ['theme''ville''dates_session''prix'],
  10.     message'Cette formation existe déjà.'
  11. )]
  12. class Formations
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     // Relation avec une table Theme (si elle existe)
  19.     #[ORM\ManyToOne]
  20.     #[ORM\JoinColumn(name"theme_id"referencedColumnName"id"nullabletrue)]
  21.     private ?Themes $theme null;
  22.     // Relation avec table Ville (si elle existe)
  23.     #[ORM\ManyToOne]
  24.     #[ORM\JoinColumn(name"ville_id"referencedColumnName"id"nullabletrue)]
  25.     private ?Villes $ville null;
  26.     #[ORM\Column(type"string"nullabletrue)]
  27.     private ?string $dates_session null;
  28.     #[ORM\Column(type"decimal"precision10scale2nullabletrue)]
  29.     private ?string $prix null;
  30.     #[ORM\Column(length10nullabletrueoptions: ['default' => 'EURO'])]
  31.     private ?string $devise 'EURO';
  32.     
  33.     #[ORM\Column(length10nullabletrue)]
  34.     private ?string $image;
  35.     #[ORM\Column(type"datetime"nullabletrueoptions: ['default' => 'CURRENT_TIMESTAMP'])]
  36.     private ?\DateTimeInterface $created_at null;
  37.     public function __construct()
  38.     {
  39.         $this->created_at = new \DateTime();
  40.     }
  41.     public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.     // public function getCatid(): ?Categories { return $this->catid; }
  46.     // public function setCatid(?Categories $catid): static { $this->catid = $catid; return $this; }
  47.     public function getTheme(): ?Themes{return $this->theme;}
  48.     public function setTheme(?Themes $theme): self{$this->theme $theme;return $this;}
  49.     public function getVille(): ?Villes{ return $this->ville;}
  50.     public function setVille(?Villes $ville): self{$this->ville $ville;return $this;}
  51.     public function getDatesSession(): ?String{ return $this->dates_session;}
  52.     public function setDatesSession(?String $dates_session): self $this->dates_session $dates_session;return $this;}
  53.     public function getPrix(): ?string{return $this->prix;}
  54.     public function setPrix(?string $prix): self{$this->prix $prix;return $this;}
  55.     public function getDevise(): ?string{return $this->devise;}
  56.     public function setDevise(?string $devise): self{$this->devise $devise;return $this;}
  57.     public function getImage(): ?string{return $this->image;}
  58.     public function setImage(?string $image): self{$this->image $image;return $this;}
  59.     public function getCreatedAt(): ?\DateTimeInterface{return $this->created_at;}
  60.     public function setCreatedAt(?\DateTimeInterface $created_at): self {$this->created_at $created_at;return $this;}
  61. }