| Current Path : /var/www/v3.cesa.co.za/src/ContentBundle/Entity/ |
| Current File : /var/www/v3.cesa.co.za/src/ContentBundle/Entity/Form.php |
<?php
namespace App\ContentBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* Form
*
* @ORM\Table(name="content_form")
* @ORM\Entity(repositoryClass="App\ContentBundle\Repository\FormRepository")
* @ORM\HasLifecycleCallbacks
*/
class Form
{
/**
* @ORM\Id
* @ORM\Column(type="string", unique=true)
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator")
*/
private $id;
/**
* @ORM\Column(type="string", columnDefinition="enum('cesa', 'marketing', 'sce', 'bce', 'cpd')")
*/
private $department;
/**
* @ORM\Column(type="string", length=255)
*/
private $bce_modules;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $to_name;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $to_e_mail;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $title;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $action;
/**
* @ORM\Column(type="string", length=5, nullable=true)
*/
private $method;
/**
* @ORM\Column(type="string", length=5, nullable=true)
*/
private $inner_html;
/**
* @ORM\Column(type="datetime")
*/
private $start_date;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $end_date;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default": true})
*/
private $is_public;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default": false})
*/
private $is_active;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default": false})
*/
private $is_deleted;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default": false})
*/
private $add_referral;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default": false})
*/
private $survey;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $created_by;
/**
* @ORM\Column(type="datetime")
*/
private $created_at;
/**
* @ORM\Column(type="datetime")
*/
private $updated_at;
/**
* @ORM\ManyToOne(targetEntity="FormType")
* @ORM\JoinColumn(name="form_type_id", referencedColumnName="id")
*/
private $form_type;
/**
* @ORM\OneToMany(targetEntity="FormItemForm", mappedBy="form", cascade={"persist", "remove"})
*/
private $form_items;
/**
* @ORM\OneToMany(targetEntity="FormCompleted", mappedBy="form", cascade={"persist", "remove"})
*/
private $form_completed;
public function __construct()
{
$this->form_items = new ArrayCollection();
$this->form_completed = new ArrayCollection();
}
public function getId(): ?string
{
return $this->id;
}
public function getDepartment(): ?string
{
return $this->department;
}
public function setDepartment(string $department): static
{
$this->department = $department;
return $this;
}
public function getBceModules(): ?string
{
return $this->bce_modules;
}
public function setBceModules(string $bce_modules): static
{
$this->bce_modules = $bce_modules;
return $this;
}
public function getToName(): ?string
{
return $this->to_name;
}
public function setToName(?string $to_name): static
{
$this->to_name = $to_name;
return $this;
}
public function getToEMail(): ?string
{
return $this->to_e_mail;
}
public function setToEMail(?string $to_e_mail): static
{
$this->to_e_mail = $to_e_mail;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): static
{
$this->title = $title;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
public function getAction(): ?string
{
return $this->action;
}
public function setAction(?string $action): static
{
$this->action = $action;
return $this;
}
public function getMethod(): ?string
{
return $this->method;
}
public function setMethod(?string $method): static
{
$this->method = $method;
return $this;
}
public function getInnerHtml(): ?string
{
return $this->inner_html;
}
public function setInnerHtml(?string $inner_html): static
{
$this->inner_html = $inner_html;
return $this;
}
public function getStartDate(): ?\DateTimeInterface
{
return $this->start_date;
}
public function setStartDate(\DateTimeInterface $start_date): static
{
$this->start_date = $start_date;
return $this;
}
public function getEndDate(): ?\DateTimeInterface
{
return $this->end_date;
}
public function setEndDate(?\DateTimeInterface $end_date): static
{
$this->end_date = $end_date;
return $this;
}
/**
* Check if the form is currently active based on the end date.
*
* @return bool True if the form has no end date or if the end date is in the future
*/
public function isCurrentlyActive(): bool
{
if ($this->end_date === null) {
return true;
}
return $this->end_date > new \DateTime();
}
public function isIsPublic(): ?bool
{
return $this->is_public;
}
public function setIsPublic(?bool $is_public): static
{
$this->is_public = $is_public;
return $this;
}
public function isIsActive(): ?bool
{
return $this->is_active;
}
public function setIsActive(?bool $is_active): static
{
$this->is_active = $is_active;
return $this;
}
public function isIsDeleted(): ?bool
{
return $this->is_deleted;
}
public function setIsDeleted(?bool $is_deleted): static
{
$this->is_deleted = $is_deleted;
return $this;
}
public function isAddReferral(): ?bool
{
return $this->add_referral;
}
public function setAddReferral(?bool $add_referral): static
{
$this->add_referral = $add_referral;
return $this;
}
public function isSurvey(): ?bool
{
return $this->survey;
}
public function setSurvey(?bool $survey): static
{
$this->survey = $survey;
return $this;
}
public function getCreatedBy(): ?string
{
return $this->created_by;
}
public function setCreatedBy(?string $created_by): static
{
$this->created_by = $created_by;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeInterface $created_at): static
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updated_at;
}
public function setUpdatedAt(\DateTimeInterface $updated_at): static
{
$this->updated_at = $updated_at;
return $this;
}
/**
* @return Collection<int, FormItemForm>
*/
public function getFormItems(): Collection
{
return $this->form_items;
}
public function addFormItem(FormItemForm $formItem): static
{
if (!$this->form_items->contains($formItem)) {
$this->form_items->add($formItem);
$formItem->setForm($this);
}
return $this;
}
public function removeFormItem(FormItemForm $formItem): static
{
if ($this->form_items->removeElement($formItem)) {
// set the owning side to null (unless already changed)
if ($formItem->getForm() === $this) {
$formItem->setForm(null);
}
}
return $this;
}
/**
* @return Collection<int, FormCompleted>
*/
public function getFormCompleted(): Collection
{
return $this->form_completed;
}
public function addFormCompleted(FormCompleted $formCompleted): static
{
if (!$this->form_completed->contains($formCompleted)) {
$this->form_completed->add($formCompleted);
$formCompleted->setForm($this);
}
return $this;
}
public function removeFormCompleted(FormCompleted $formCompleted): static
{
if ($this->form_completed->removeElement($formCompleted)) {
// set the owning side to null (unless already changed)
if ($formCompleted->getForm() === $this) {
$formCompleted->setForm(null);
}
}
return $this;
}
public function getFormType(): ?FormType
{
return $this->form_type;
}
public function setFormType(?FormType $form_type): static
{
$this->form_type = $form_type;
return $this;
}
/**
* @ORM\PrePersist
*/
public function setCreatedAtValue()
{
if (is_null($this->getCreatedAt())) {
$this->setCreatedAt(new \DateTime());
}
if (is_null($this->getUpdatedAt())) {
$this->setUpdatedAt(new \DateTime());
}
}
/**
* @ORM\PreUpdate
*/
public function setUpdatedAtValue()
{
$this->setUpdatedAt(new \DateTime());
}
public function getArray(): ?array
{
return array(
'title' => $this->getTitle(),
'toName' => $this->getToName(),
'toEMail' => $this->getToEMail(),
);
}
public function isPublic(): ?bool
{
return $this->is_public;
}
public function isActive(): ?bool
{
return $this->is_active;
}
public function isDeleted(): ?bool
{
return $this->is_deleted;
}
}