<?php
namespace App\Entity;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\SurveyCampaignRepository")
*/
class SurveyCampaign
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var string
*
* @ORM\Column(type="string", length=50)
*/
private $uniqueId;
/**
* @var string
*
* @ORM\Column(type="string", length=50)
* @Assert\Length(max=64)
* @Assert\NotBlank()
*/
private $name;
/**
* @ORM\Column(type="boolean")
*/
private $isActive;
/**
* @var DateTime
*
* @ORM\Column(type="datetime", nullable=false)
*/
private $createdAt;
/**
* @var DateTime
*
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @var Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\SurveyCampaignSubmission", mappedBy="surveyCampaign", cascade={"persist"})
*/
private $surveyCampaignSubmissions;
/**
* Company constructor.
*/
public function __construct()
{
$this->isActive = true;
$this->createdAt = new \DateTime();
$this->updatedAt = new \DateTime();
$this->surveyCampaignSubmissions = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getUniqueId(): ?string
{
return $this->uniqueId;
}
public function setUniqueId(string $uniqueId): self
{
$this->uniqueId = $uniqueId;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getCreatedAt(): DateTime
{
return $this->createdAt;
}
public function setCreatedAt(DateTime $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?DateTime
{
return $this->updatedAt;
}
public function setUpdatedAt(?DateTime $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @return Collection|SurveyCampaignSubmission[]
*/
public function getSurveyCampaignSubmissions(): Collection
{
return $this->surveyCampaignSubmissions;
}
public function addSurveyCampaignSubmission(SurveyCampaignSubmission $surveyCampaignSubmission): self
{
if (!$this->surveyCampaignSubmissions->contains($surveyCampaignSubmission)) {
$this->surveyCampaignSubmissions[] = $surveyCampaignSubmission;
$surveyCampaignSubmission->setCompany($this);
}
return $this;
}
public function removeSurveyCampaignSubmission(SurveyCampaignSubmission $surveyCampaignSubmission): self
{
if ($this->surveyCampaignSubmissions->contains($surveyCampaignSubmission)) {
$this->surveyCampaignSubmissions->removeElement($surveyCampaignSubmission);
// set the owning side to null (unless already changed)
if ($surveyCampaignSubmission->getCompany() === $this) {
$surveyCampaignSubmission->setCompany(null);
}
}
return $this;
}
}