src/Flexy/ShopBundle/Entity/Payment/ModalityPayment.php line 20
<?php
namespace App\Flexy\ShopBundle\Entity\Payment;
use App\Repository\Flexy\ShopBundle\Entity\Payment\modalityPaymentRepository;
use Doctrine\ORM\Mapping as ORM;
use \App\Flexy\ShopBundle\Entity\Order\Order;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\HttpFoundation\File\File;
/**
* @Vich\Uploadable
*/
#[ORM\Entity(repositoryClass: modalityPaymentRepository::class)]
class ModalityPayment
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $mode_reglement = null;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $date = null;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $updatedAt = null;
#[ORM\Column(nullable: true)]
private ?float $montant = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $description = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $photo = null;
/**
* @Vich\UploadableField(mapping="modalite_photos", fileNameProperty="photo")
*/
private ?\Symfony\Component\HttpFoundation\File\File $photoFile = null;
#[ORM\ManyToOne(inversedBy: 'modalityPayments')]
private ?Order $order_source = null;
public function __toString()
{
return (string)"(".$this->mode_reglement." - Montant : ".$this->montant." DH"." - Date : ".$this->date->format('d-m-Y H:i:s')." )";
}
public function __construct() {
$this->date = new \DateTimeImmutable();
}
public function getId(): ?int
{
return $this->id;
}
public function getModeReglement(): ?string
{
return $this->mode_reglement;
}
public function setModeReglement(?string $mode_reglement): static
{
$this->mode_reglement = $mode_reglement;
return $this;
}
public function getDate(): ?\DateTimeImmutable
{
return $this->date;
}
public function setDate(?\DateTimeImmutable $date): static
{
$this->date = $date;
return $this;
}
public function getMontant(): ?float
{
return $this->montant;
}
public function setMontant(?float $montant): static
{
$this->montant = $montant;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
public function getPhoto(): ?string
{
return $this->photo;
}
public function setPhoto(?string $photo): static
{
$this->photo = $photo;
return $this;
}
public function getPhotoFile()
{
return $this->photoFile;
}
public function setPhotoFile(File $photoFile = null)
{
$this->photoFile = $photoFile;
if ($photoFile) {
// Met à jour la date pour forcer Doctrine à persister l'entité
$this->updatedAt = new \DateTimeImmutable();
}
}
public function getOrderSource(): ?Order
{
return $this->order_source;
}
public function setOrderSource(?Order $order_source): static
{
$this->order_source = $order_source;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
}