<?php
namespace App\Entity;
use App\Repository\SouscriptionRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SouscriptionRepository::class)
*/
class Souscription
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="integer")
*/
private $quantite;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="souscriptions")
* @ORM\JoinColumn(nullable=false)
*/
private $user;
/**
* @ORM\Column(type="datetime")
*/
private $created_at;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $validated_at;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $started_at;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $end_at;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $cancelled_at;
/**
* @ORM\ManyToOne(targetEntity=Facture::class, inversedBy="souscriptions")
*/
private $facture;
/**
* @ORM\ManyToOne(targetEntity=Package::class, inversedBy="souscriptions")
*/
private $package;
/**
* @ORM\ManyToOne(targetEntity=ProgrammeFormation::class, inversedBy="souscriptions")
*/
private $programme_formation;
/**
* @ORM\Column(type="string", length=255)
*/
private $titre;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $prix;
/**
* @ORM\Column(type="integer")
*/
private $status;
const FULL_STATUS =['non validé','validé','annulé'];
public function __construct()
{
$this->created_at = new \DateTime();
$this->status = 0;
}
public function getFullStatus()
{
return self::FULL_STATUS[$this->status];
}
public function getId(): ?int
{
return $this->id;
}
public function getQuantite(): ?int
{
return $this->quantite;
}
public function setQuantite(int $quantite): self
{
$this->quantite = $quantite;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getValidatedAt(): ?\DateTimeInterface
{
return $this->validated_at;
}
public function setValidatedAt(?\DateTimeInterface $validated_at): self
{
$this->validated_at = $validated_at;
return $this;
}
public function getStartedAt(): ?\DateTimeInterface
{
return $this->started_at;
}
public function setStartedAt(?\DateTimeInterface $started_at): self
{
$this->started_at = $started_at;
return $this;
}
public function getEndAt(): ?\DateTimeInterface
{
return $this->end_at;
}
public function setEndAt(?\DateTimeInterface $end_at): self
{
$this->end_at = $end_at;
return $this;
}
public function getCancelledAt(): ?\DateTimeInterface
{
return $this->cancelled_at;
}
public function setCancelledAt(?\DateTimeInterface $cancelled_at): self
{
$this->cancelled_at = $cancelled_at;
return $this;
}
public function getFacture(): ?Facture
{
return $this->facture;
}
public function setFacture(?Facture $facture): self
{
$this->facture = $facture;
return $this;
}
public function getPackage(): ?Package
{
return $this->package;
}
public function setPackage(?Package $package): self
{
$this->package = $package;
return $this;
}
public function getProgrammeFormation(): ?ProgrammeFormation
{
return $this->programme_formation;
}
public function setProgrammeFormation(?ProgrammeFormation $programme_formation): self
{
$this->programme_formation = $programme_formation;
return $this;
}
public function getTitre(): ?string
{
return $this->titre;
}
public function setTitre(string $titre): self
{
$this->titre = $titre;
return $this;
}
public function getPrix(): ?float
{
return $this->prix;
}
public function setPrix(?float $prix): self
{
$this->prix = $prix;
return $this;
}
public function getStatus(): ?int
{
return $this->status;
}
public function setStatus(int $status): self
{
$this->status = $status;
return $this;
}
}