<?php
namespace App\Entity;
use App\Repository\MediaChannelRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MediaChannelRepository::class)]
class MediaChannel
{
const TRACKING_CODE = "?utm_source=";
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $name = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $trackingCode = null;
#[ORM\Column(type: 'boolean', nullable: true)]
private ?bool $status = null;
#[ORM\OneToMany(targetEntity: Profile::class, mappedBy: 'mediaChannel')]
private Collection $profiles;
public function __construct()
{
$this->profiles = 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;
}
public function getTrackingCode(): ?string
{
return $this->trackingCode;
}
public function setTrackingCode(?string $trackingCode): self
{
$this->trackingCode = $trackingCode;
return $this;
}
public function getStatus(): ?bool
{
return $this->status;
}
public function setStatus(?bool $status): self
{
$this->status = $status;
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->setMediaChannel($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->getMediaChannel() === $this) {
$profile->setMediaChannel(null);
}
}
return $this;
}
}