<?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
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $title;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $type;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $device;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $start_date;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $end_date;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $time_matrix;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $utm_medium;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $utm_source;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $utm_campaign;
/**
* @ORM\Column(type="string", length=5, nullable=true)
*/
private $zone;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $origin;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $origin_name;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $destination;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $destination_name;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $bid;
/**
* @ORM\Column(type="integer", nullable=true, options={"default" : 0})
*/
private $daily_budget;
/**
* @ORM\Column(type="integer", options={"default" : 0})
*/
private $daily_spent = 0;
/**
* @ORM\Column(type="integer", nullable=true, options={"default" : 0})
*/
private $spent = 0;
/**
* @ORM\Column(type="integer", options={"default" : 0})
*/
private $impression = 0;
/**
* @ORM\Column(type="integer", options={"default" : 0})
*/
private $click = 0;
/**
* @ORM\Column(type="decimal", scale=3, options={"default" : 0})
*/
private $ctr = 0;
/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
private $status;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="campaigns")
* @ORM\JoinColumn(nullable=false)
*/
private $created_by;
/**
* @ORM\Column(type="datetime")
*/
private $created_at;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*/
private $updated_by;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updated_at;
/**
* @ORM\OneToMany(targetEntity=Media::class, mappedBy="campaign")
*/
private $media;
/**
* @ORM\Column(type="boolean", options={"default":true})
*/
private $has_fund;
/**
* @ORM\OneToMany(targetEntity=CampaignStat::class, mappedBy="campaign", orphanRemoval=true)
*/
private $campaignStats;
public function __construct()
{
$this->media = new ArrayCollection();
$this->campaignStats = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getDevice(): ?string
{
return $this->device;
}
public function setDevice(?string $device): self
{
$this->device = $device;
return $this;
}
public function getStartDate(): ?\DateTimeInterface
{
return $this->start_date;
}
public function setStartDate(?\DateTimeInterface $start_date): self
{
$this->start_date = $start_date;
return $this;
}
public function getEndDate(): ?\DateTimeInterface
{
return $this->end_date;
}
public function setEndDate(?\DateTimeInterface $end_date): self
{
$this->end_date = $end_date;
return $this;
}
public function getTimeMatrix(): ?string
{
return $this->time_matrix;
}
public function setTimeMatrix(?string $time_matrix): self
{
$this->time_matrix = $time_matrix;
return $this;
}
public function getUtmMedium(): ?string
{
return $this->utm_medium;
}
public function setUtmMedium(?string $utm_medium): self
{
$this->utm_medium = $utm_medium;
return $this;
}
public function getUtmSource(): ?string
{
return $this->utm_source;
}
public function setUtmSource(?string $utm_source): self
{
$this->utm_source = $utm_source;
return $this;
}
public function getUtmCampaign(): ?string
{
return $this->utm_campaign;
}
public function setUtmCampaign(?string $utm_campaign): self
{
$this->utm_campaign = $utm_campaign;
return $this;
}
public function getZone(): ?string
{
return $this->zone;
}
public function setZone(?string $zone): self
{
$this->zone = $zone;
return $this;
}
public function getOrigin(): ?string
{
return $this->origin;
}
public function setOrigin(?string $origin): self
{
$this->origin = $origin;
return $this;
}
public function getOriginName(): ?string
{
return $this->origin_name;
}
public function setOriginName(?string $origin_name): self
{
$this->origin_name = $origin_name;
return $this;
}
public function getDestination(): ?string
{
return $this->destination;
}
public function setDestination(?string $destination): self
{
$this->destination = $destination;
return $this;
}
public function getDestinationName(): ?string
{
return $this->destination_name;
}
public function setDestinationName(?string $destination_name): self
{
$this->destination_name = $destination_name;
return $this;
}
public function getBid(): ?int
{
return $this->bid;
}
public function setBid(?int $bid): self
{
$this->bid = $bid;
return $this;
}
public function getDailyBudget(): ?int
{
return $this->daily_budget;
}
public function setDailyBudget(?int $daily_budget): self
{
$this->daily_budget = $daily_budget;
return $this;
}
public function getSpent(): ?int
{
return $this->spent;
}
public function setSpent(?int $spent): self
{
$this->spent = $spent;
return $this;
}
public function getImpression(): ?int
{
return $this->impression;
}
public function setImpression(int $impression): self
{
$this->impression = $impression;
return $this;
}
public function getClick(): ?int
{
return $this->click;
}
public function setClick(int $click): self
{
$this->click = $click;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): self
{
$this->status = $status;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->created_by;
}
public function setCreatedBy(?User $created_by): self
{
$this->created_by = $created_by;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedBy(): ?User
{
return $this->updated_by;
}
public function setUpdatedBy(?User $updated_by): self
{
$this->updated_by = $updated_by;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updated_at;
}
public function setUpdatedAt(?\DateTimeInterface $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
/**
* @return Collection|Media[]
*/
public function getMedia(): Collection
{
return $this->media;
}
public function addMedium(Media $medium): self
{
if (!$this->media->contains($medium)) {
$this->media[] = $medium;
$medium->setCampaign($this);
}
return $this;
}
public function removeMedium(Media $medium): self
{
if ($this->media->removeElement($medium)) {
// set the owning side to null (unless already changed)
if ($medium->getCampaign() === $this) {
$medium->setCampaign(null);
}
}
return $this;
}
public function getDailySpent(): ?int
{
return $this->daily_spent;
}
public function setDailySpent(int $daily_spent): self
{
$this->daily_spent = $daily_spent;
return $this;
}
public function getCtr(): ?float
{
return $this->ctr;
}
public function setCtr(float $ctr): self
{
$this->ctr = $ctr;
return $this;
}
public function getHasFund(): ?bool
{
return $this->has_fund;
}
public function setHasFund(bool $has_fund = true): self
{
$this->has_fund = $has_fund;
return $this;
}
/**
* @return Collection|CampaignStat[]
*/
public function getCampaignStats(): Collection
{
return $this->campaignStats;
}
public function addCampaignStat(CampaignStat $campaignStat): self
{
if (!$this->campaignStats->contains($campaignStat)) {
$this->campaignStats[] = $campaignStat;
$campaignStat->setCampaign($this);
}
return $this;
}
public function removeCampaignStat(CampaignStat $campaignStat): self
{
if ($this->campaignStats->removeElement($campaignStat)) {
// set the owning side to null (unless already changed)
if ($campaignStat->getCampaign() === $this) {
$campaignStat->setCampaign(null);
}
}
return $this;
}
}