src/Entity/SurveyCampaign.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTime;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9.  * @ORM\Entity(repositoryClass="App\Repository\SurveyCampaignRepository")
  10.  */
  11. class SurveyCampaign
  12. {
  13.     /**
  14.      * @ORM\Id()
  15.      * @ORM\GeneratedValue()
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @var string
  21.      *
  22.      * @ORM\Column(type="string", length=50)
  23.      */
  24.     private $uniqueId;
  25.     /**
  26.      * @var string
  27.      *
  28.      * @ORM\Column(type="string", length=50)
  29.      * @Assert\Length(max=64)
  30.      * @Assert\NotBlank()
  31.      */
  32.     private $name;
  33.     /**
  34.      * @ORM\Column(type="boolean")
  35.      */
  36.     private $isActive;
  37.     /**
  38.      * @var DateTime
  39.      *
  40.      * @ORM\Column(type="datetime", nullable=false)
  41.      */
  42.     private $createdAt;
  43.     /**
  44.      * @var DateTime
  45.      *
  46.      * @ORM\Column(type="datetime", nullable=true)
  47.      */
  48.     private $updatedAt;
  49.     /**
  50.      * @var Collection
  51.      *
  52.      * @ORM\OneToMany(targetEntity="App\Entity\SurveyCampaignSubmission", mappedBy="surveyCampaign", cascade={"persist"})
  53.      */
  54.     private $surveyCampaignSubmissions;
  55.     /**
  56.      * Company constructor.
  57.      */
  58.     public function __construct()
  59.     {
  60.         $this->isActive true;
  61.         $this->createdAt = new \DateTime();
  62.         $this->updatedAt = new \DateTime();
  63.         $this->surveyCampaignSubmissions = new ArrayCollection();
  64.     }
  65.     public function getId(): ?int
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getUniqueId(): ?string
  70.     {
  71.         return $this->uniqueId;
  72.     }
  73.     public function setUniqueId(string $uniqueId): self
  74.     {
  75.         $this->uniqueId $uniqueId;
  76.         return $this;
  77.     }
  78.     public function getName(): ?string
  79.     {
  80.         return $this->name;
  81.     }
  82.     public function setName(string $name): self
  83.     {
  84.         $this->name $name;
  85.         return $this;
  86.     }
  87.     public function getIsActive(): ?bool
  88.     {
  89.         return $this->isActive;
  90.     }
  91.     public function setIsActive(bool $isActive): self
  92.     {
  93.         $this->isActive $isActive;
  94.         return $this;
  95.     }
  96.     public function getCreatedAt(): DateTime
  97.     {
  98.         return $this->createdAt;
  99.     }
  100.     public function setCreatedAt(DateTime $createdAt): self
  101.     {
  102.         $this->createdAt $createdAt;
  103.         return $this;
  104.     }
  105.     public function getUpdatedAt(): ?DateTime
  106.     {
  107.         return $this->updatedAt;
  108.     }
  109.     public function setUpdatedAt(?DateTime $updatedAt): self
  110.     {
  111.         $this->updatedAt $updatedAt;
  112.         return $this;
  113.     }
  114.     /**
  115.      * @return Collection|SurveyCampaignSubmission[]
  116.      */
  117.     public function getSurveyCampaignSubmissions(): Collection
  118.     {
  119.         return $this->surveyCampaignSubmissions;
  120.     }
  121.     public function addSurveyCampaignSubmission(SurveyCampaignSubmission $surveyCampaignSubmission): self
  122.     {
  123.         if (!$this->surveyCampaignSubmissions->contains($surveyCampaignSubmission)) {
  124.             $this->surveyCampaignSubmissions[] = $surveyCampaignSubmission;
  125.             $surveyCampaignSubmission->setCompany($this);
  126.         }
  127.         return $this;
  128.     }
  129.     public function removeSurveyCampaignSubmission(SurveyCampaignSubmission $surveyCampaignSubmission): self
  130.     {
  131.         if ($this->surveyCampaignSubmissions->contains($surveyCampaignSubmission)) {
  132.             $this->surveyCampaignSubmissions->removeElement($surveyCampaignSubmission);
  133.             // set the owning side to null (unless already changed)
  134.             if ($surveyCampaignSubmission->getCompany() === $this) {
  135.                 $surveyCampaignSubmission->setCompany(null);
  136.             }
  137.         }
  138.         return $this;
  139.     }
  140. }