<?php
namespace App\Entity;
use App\Repository\CampaignRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CampaignRepository::class)]
class Campaign
{
const JPO_TYPE = 1;
const APPLICATION = 4;
const APPOINTMENT = 2;
const DOCUMENT = 3;
const LANDING_PAGE = 9;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private ?string $name = null;
#[ORM\OneToMany(targetEntity: Profile::class, mappedBy: 'campaign')]
private Collection $profiles;
#[ORM\Column(type: 'integer', nullable: true)]
private ?string $type = null;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $ordering = null;
#[ORM\OneToMany(targetEntity: OpenDay::class, mappedBy: 'campaign')]
private Collection $openDays;
public function __construct()
{
$this->profiles = new ArrayCollection();
$this->openDays = new ArrayCollection();
}
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;
}
/**
* @return Collection<int, Profile>
*/
public function getProfiles(): Collection
{
return $this->profiles;
}
public function addProfile(Profile $profile): self
{
if (!$this->profiles->contains($profile)) {
$this->profiles[] = $profile;
$profile->setCampaign($this);
}
return $this;
}
public function removeProfile(Profile $profile): self
{
if ($this->profiles->removeElement($profile)) {
// set the owning side to null (unless already changed)
if ($profile->getCampaign() === $this) {
$profile->setCampaign(null);
}
}
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getOrdering(): ?int
{
return $this->ordering;
}
public function setOrdering(?int $ordering): self
{
$this->ordering = $ordering;
return $this;
}
/**
* @return Collection<int, OpenDay>
*/
public function getOpenDays(): Collection
{
return $this->openDays;
}
public function addOpenDay(OpenDay $openDay): self
{
if (!$this->openDays->contains($openDay)) {
$this->openDays[] = $openDay;
$openDay->setCampaign($this);
}
return $this;
}
public function removeOpenDay(OpenDay $openDay): self
{
if ($this->openDays->removeElement($openDay)) {
// set the owning side to null (unless already changed)
if ($openDay->getCampaign() === $this) {
$openDay->setCampaign(null);
}
}
return $this;
}
}