<?php
namespace App\Entity\Request;
use App\Entity\Client\SupportUser;
use App\Entity\Configuration\Survey;
use App\Entity\Languages;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use App\Repository\Request\RequestFormRepository;
use Gedmo\Timestampable\Traits\TimestampableEntity;
#[ORM\Entity(repositoryClass: RequestFormRepository::class)]
class RequestForm
{
use TimestampableEntity;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $name = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $company = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $telephone = null;
#[ORM\Column(nullable: true)]
private ?bool $isOtherValue = null;
#[ORM\ManyToOne]
private ?Languages $language = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $email = null;
#[ORM\OneToMany(mappedBy: 'requestForm', targetEntity: RequestDetails::class, orphanRemoval: true)]
private Collection $requestDetails;
#[ORM\ManyToOne(inversedBy: 'requestForms')]
#[ORM\JoinColumn(nullable: false)]
private ?RequestStatus $requestStatus = null;
#[ORM\OneToMany(mappedBy: 'requestForm', targetEntity: RequestHistory::class, orphanRemoval: true)]
private Collection $requestHistories;
#[ORM\Column(length: 255, nullable: true)]
private ?string $reference = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $descriptionForm = null;
#[ORM\ManyToOne(inversedBy: 'requestForms')]
#[ORM\JoinColumn(nullable: false)]
private ?Survey $survey = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $requestNum = null;
#[ORM\ManyToOne(inversedBy: 'requestForms')]
private ?SupportUser $supportUser = null;
public function __construct()
{
$this->requestDetails = new ArrayCollection();
$this->requestHistories = new ArrayCollection();
$this->createdAt = new \DateTime();
$this->updatedAt = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getCompany(): ?string
{
return $this->company;
}
public function setCompany(?string $company): self
{
$this->company = $company;
return $this;
}
public function getTelephone(): ?string
{
return $this->telephone;
}
public function setTelephone(?string $telephone): self
{
$this->telephone = $telephone;
return $this;
}
public function isIsOtherValue(): ?bool
{
return $this->isOtherValue;
}
public function setIsOtherValue(?bool $isOtherValue): self
{
$this->isOtherValue = $isOtherValue;
return $this;
}
public function getLanguage(): ?Languages
{
return $this->language;
}
public function setLanguage(?Languages $language): self
{
$this->language = $language;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
/**
* @return Collection<int, RequestDetails>
*/
public function getRequestDetails(): Collection
{
return $this->requestDetails;
}
public function addRequestDetail(RequestDetails $requestDetail): self
{
if (!$this->requestDetails->contains($requestDetail)) {
$this->requestDetails->add($requestDetail);
$requestDetail->setRequestForm($this);
}
return $this;
}
public function removeRequestDetail(RequestDetails $requestDetail): self
{
if ($this->requestDetails->removeElement($requestDetail)) {
// set the owning side to null (unless already changed)
if ($requestDetail->getRequestForm() === $this) {
$requestDetail->setRequestForm(null);
}
}
return $this;
}
public function getRequestStatus(): ?RequestStatus
{
return $this->requestStatus;
}
public function setRequestStatus(?RequestStatus $requestStatus): self
{
$this->requestStatus = $requestStatus;
return $this;
}
/**
* @return Collection<int, RequestHistory>
*/
public function getRequestHistories(): Collection
{
return $this->requestHistories;
}
public function addRequestHistory(RequestHistory $requestHistory): self
{
if (!$this->requestHistories->contains($requestHistory)) {
$this->requestHistories->add($requestHistory);
$requestHistory->setRequestForm($this);
}
return $this;
}
public function removeRequestHistory(RequestHistory $requestHistory): self
{
if ($this->requestHistories->removeElement($requestHistory)) {
// set the owning side to null (unless already changed)
if ($requestHistory->getRequestForm() === $this) {
$requestHistory->setRequestForm(null);
}
}
return $this;
}
public function getReference(): ?string
{
return $this->reference;
}
public function setReference(?string $reference): self
{
$this->reference = $reference;
return $this;
}
public function getDescriptionForm(): ?string
{
return $this->descriptionForm;
}
public function setDescriptionForm(?string $descriptionForm): self
{
$this->descriptionForm = $descriptionForm;
return $this;
}
public function getSurvey(): ?Survey
{
return $this->survey;
}
public function setSurvey(?Survey $survey): self
{
$this->survey = $survey;
return $this;
}
public function getRequestNum(): ?string
{
return $this->requestNum;
}
public function setRequestNum(?string $requestNum): self
{
$this->requestNum = $requestNum;
return $this;
}
public function getSupportUser(): ?SupportUser
{
return $this->supportUser;
}
public function setSupportUser(?SupportUser $supportUser): static
{
$this->supportUser = $supportUser;
return $this;
}
}