src/Flexy/ShopBundle/Entity/Payment/ModalityPayment.php line 20

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Payment;
  3. use App\Repository\Flexy\ShopBundle\Entity\Payment\modalityPaymentRepository;
  4.  
  5. use Doctrine\ORM\Mapping as ORM;
  6. use \App\Flexy\ShopBundle\Entity\Order\Order;
  7. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  8. use Symfony\Component\HttpFoundation\File\File;
  9. /**
  10.  * @Vich\Uploadable
  11.  */
  12. #[ORM\Entity(repositoryClassmodalityPaymentRepository::class)]
  13. class ModalityPayment
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     private ?int $id null;
  19.     #[ORM\Column(length255nullabletrue)]
  20.     private ?string $mode_reglement null;
  21.     #[ORM\Column(nullabletrue)]
  22.     private ?\DateTimeImmutable $date null;
  23.     #[ORM\Column(nullabletrue)]
  24.     private ?\DateTimeImmutable $updatedAt null;
  25.     
  26.     #[ORM\Column(nullabletrue)]
  27.     private ?float $montant null;
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $description null;
  30.     #[ORM\Column(length255nullabletrue)]
  31.     private ?string $photo null;
  32.     /**
  33.      * @Vich\UploadableField(mapping="modalite_photos", fileNameProperty="photo")
  34.      */
  35.     
  36.     private ?\Symfony\Component\HttpFoundation\File\File $photoFile null;
  37.     #[ORM\ManyToOne(inversedBy'modalityPayments')]
  38.     private ?Order $order_source null;
  39.   
  40.     public function __toString()
  41.     {
  42.         return (string)"(".$this->mode_reglement." -  Montant : ".$this->montant." DH"." - Date : ".$this->date->format('d-m-Y H:i:s')." )";
  43.     }
  44.     
  45.     public function __construct() {
  46.         $this->date = new \DateTimeImmutable();
  47.     }
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function getModeReglement(): ?string
  53.     {
  54.         return $this->mode_reglement;
  55.     }
  56.     public function setModeReglement(?string $mode_reglement): static
  57.     {
  58.         $this->mode_reglement $mode_reglement;
  59.         return $this;
  60.     }
  61.     public function getDate(): ?\DateTimeImmutable
  62.     {
  63.         return $this->date;
  64.     }
  65.     public function setDate(?\DateTimeImmutable $date): static
  66.     {
  67.         $this->date $date;
  68.         return $this;
  69.     }
  70.     public function getMontant(): ?float
  71.     {
  72.         return $this->montant;
  73.     }
  74.     public function setMontant(?float $montant): static
  75.     {
  76.         $this->montant $montant;
  77.         return $this;
  78.     }
  79.     public function getDescription(): ?string
  80.     {
  81.         return $this->description;
  82.     }
  83.     public function setDescription(?string $description): static
  84.     {
  85.         $this->description $description;
  86.         return $this;
  87.     }
  88.     public function getPhoto(): ?string
  89.     {
  90.         return $this->photo;
  91.     }
  92.     public function setPhoto(?string $photo): static
  93.     {
  94.         $this->photo $photo;
  95.         return $this;
  96.     }
  97.     public function getPhotoFile()
  98.     {
  99.         return $this->photoFile;
  100.     }
  101.     
  102.     public function setPhotoFile(File $photoFile null)
  103.     {
  104.         $this->photoFile $photoFile;
  105.     
  106.         if ($photoFile) {
  107.             // Met à jour la date pour forcer Doctrine à persister l'entité
  108.             $this->updatedAt = new \DateTimeImmutable();
  109.              
  110.         }
  111.     }
  112.     public function getOrderSource(): ?Order
  113.     {
  114.         return $this->order_source;
  115.     }
  116.     public function setOrderSource(?Order $order_source): static
  117.     {
  118.         $this->order_source $order_source;
  119.         return $this;
  120.     }
  121.     public function getUpdatedAt(): ?\DateTimeInterface
  122.     {
  123.         return $this->updatedAt;
  124.     }
  125.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  126.     {
  127.         $this->updatedAt $updatedAt;
  128.         return $this;
  129.     }
  130.     
  131.     
  132. }