<?php
namespace App\Entity;
use App\Repository\ReductionRequestRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity(repositoryClass=ReductionRequestRepository::class)
* @Vich\Uploadable
*/
class ReductionRequest
{
const ACCEPTED = "accepted";
const REJECTED = "rejected";
public function __construct()
{
$this->creationDate = new \DateTime();
}
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Contact::class, inversedBy="reductionRequests")
* @ORM\JoinColumn(nullable=false)
*/
private $contact;
/**
* @ORM\ManyToOne(targetEntity=Reduction::class, inversedBy="reductionRequests")
* @ORM\JoinColumn(nullable=true)
*/
private $reduction;
/**
* @ORM\Column(type="string", length=255, nullable = true)
*/
private $filePath;
/**
* @ORM\Column(type="boolean")
*/
private $isValid;
/**
* @ORM\Column(type="datetime")
*/
private $creationDate;
/**
* @Vich\UploadableField(mapping="private_file", fileNameProperty="filePath")
*
* @var File|null
*/
private $imgFile;
/**
* @ORM\ManyToOne(targetEntity=Commande::class, inversedBy="reductionRequest", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=false)
*/
private $commande;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $type;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $value;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $statut;
public function getId(): ?int
{
return $this->id;
}
public function getImgFile(): ?File
{
return $this->imgFile;
}
public function getContact(): ?Contact
{
return $this->contact;
}
public function setContact(?Contact $contact): self
{
$this->contact = $contact;
return $this;
}
public function getReduction(): ?Reduction
{
return $this->reduction;
}
public function setReduction(?Reduction $reduction): self
{
$this->reduction = $reduction;
return $this;
}
public function getFilePath(): ?string
{
return $this->filePath;
}
public function setFilePath(string $filePath): self
{
$this->filePath = $filePath;
return $this;
}
public function getIsValid(): ?bool
{
return $this->isValid;
}
public function setIsValid(bool $isValid): self
{
$this->isValid = $isValid;
return $this;
}
public function getCreationDate(): ?\DateTimeInterface
{
return $this->creationDate;
}
public function setCreationDate(\DateTimeInterface $creationDate): self
{
$this->creationDate = $creationDate;
return $this;
}
public function setImgFile(?File $imageFile = null): self
{
$this->imgFile = $imageFile;
if ($imageFile) {
// if 'updatedAt' is not defined in your entity, use another property
$this->updatedDate = new \DateTime('now');
}
return $this;
}
public function getCommande(): ?Commande
{
return $this->commande;
}
public function setCommande(Commande $commande): self
{
$this->commande = $commande;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getValue(): ?string
{
return $this->value;
}
public function setValue(?string $value): self
{
$this->value = $value;
return $this;
}
public function getStatut(): ?string
{
return $this->statut;
}
public function setStatut(?string $statut): self
{
$this->statut = $statut;
return $this;
}
}