<?php
namespace App\Entity;
use App\Repository\ProjectRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ProjectRepository::class)
*/
class Project
{
const TYPE_ACTIVE = 1;
const TYPE_DEACTIVATE = 2;
const CATEGORY_TYPE
= [
"allegro" => self::CATEGORY_ALLEGRO,
"google ads" => self::CATEGORY_GOOGLE_ADS,
"fb ads" => self::CATEGORY_FB_ADS,
"seo" => self::CATEGORY_SEO,
"emag" => self::CATEGORY_EMAG,
];
const CATEGORY_ALLEGRO = 1;
const CATEGORY_GOOGLE_ADS = 2;
const CATEGORY_FB_ADS = 3;
const CATEGORY_SEO = 4;
const CATEGORY_EMAG = 5;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="float")
*/
private $price;
/**
* @ORM\OneToMany(targetEntity=LoggedTime::class, mappedBy="project", cascade={"persist", "remove"})
*/
private $times;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="projects")
* @ORM\JoinColumn(nullable=true)
*/
private $leader;
/**
* @ORM\ManyToMany(targetEntity=User::class, inversedBy="clientProjects")
* @ORM\JoinTable(name="client_project")
*/
private $client;
/**
* @ORM\OneToMany(targetEntity=MaxTimeProject::class, mappedBy="project", cascade={"persist", "remove"})
*/
private $maxTimeProjects;
/**
* @ORM\ManyToMany(targetEntity=User::class, inversedBy="myProjects")
*/
private $member;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $descriptionForUser;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $SlackChannelId;
/**
* @ORM\OneToMany(targetEntity=Task::class, mappedBy="project", orphanRemoval=true)
*/
private $tasks;
/**
* @ORM\OneToMany(targetEntity=RaportAds::class, mappedBy="client", orphanRemoval=true)
*/
private $raportAds;
/**
* @ORM\ManyToOne(targetEntity=OfferPackage::class, inversedBy="projects")
*/
private $offerPackage;
/**
* @ORM\OneToMany(targetEntity=ProjectOfferPackage::class, mappedBy="project", orphanRemoval=true)
*/
private $projectOfferPackages;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $numberAllegroAccount;
/**
* @ORM\Column(type="integer")
*/
private $type;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $clientSlackChannelId;
/**
* @ORM\OneToMany(targetEntity=AllegroDataAds::class, mappedBy="project")
*/
private $allegroDataAds;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $allegroAccount;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $wantReturn;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $adsBudget;
/**
* @ORM\Column(type="integer", nullable=true, options={"default": 1})
*/
private $category;
/**
*
*/
public function __construct()
{
$this->times = new ArrayCollection();
$this->client = new ArrayCollection();
$this->maxTimeProjects = new ArrayCollection();
$this->member = new ArrayCollection();
$this->tasks = new ArrayCollection();
$this->raportAds = new ArrayCollection();
$this->projectOfferPackages = new ArrayCollection();
$this->numberAllegroAccount = 1;
$this->type = self::TYPE_ACTIVE;
$this->allegroDataAds = new ArrayCollection();
$this->category = self::CATEGORY_ALLEGRO;
}
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @return string|null
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param string $name
*
* @return $this
*/
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return string|null
*/
public function getDescription(): ?string
{
return $this->description;
}
/**
* @param string $description
*
* @return $this
*/
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return float|null
*/
public function getPrice(): ?float
{
return $this->price;
}
/**
* @param float $price
*
* @return $this
*/
public function setPrice(float $price): self
{
$this->price = $price;
return $this;
}
/**
* @return Collection|LoggedTime[]
*/
public function getTimes(): Collection
{
return $this->times;
}
/**
* @param LoggedTime $time
*
* @return $this
*/
public function addTime(LoggedTime $time): self
{
if (!$this->times->contains($time)) {
$this->times[] = $time;
$time->setProject($this);
}
return $this;
}
/**
* @param LoggedTime $time
*
* @return $this
*/
public function removeTime(LoggedTime $time): self
{
if ($this->times->removeElement($time)) {
// set the owning side to null (unless already changed)
if ($time->getProject() === $this) {
$time->setProject(null);
}
}
return $this;
}
/**
* @return User|null
*/
public function getLeader(): ?User
{
return $this->leader;
}
/**
* @param User|null $leader
*
* @return $this
*/
public function setLeader(?User $leader): self
{
$this->leader = $leader;
return $this;
}
/**
* @return Collection
*/
public function getClient(): Collection
{
return $this->client;
}
public function addClient(User $member): self
{
if (!$this->client->contains($member)) {
$this->client[] = $member;
}
return $this;
}
public function removeClient(User $member): self
{
$this->client->removeElement($member);
return $this;
}
/**
* @return Collection|MaxTimeProject[]
*/
public function getMaxTimeProjects(): Collection
{
return $this->maxTimeProjects;
}
public function addMaxTimeProject(MaxTimeProject $maxTimeProject): self
{
if (!$this->maxTimeProjects->contains($maxTimeProject)) {
$this->maxTimeProjects[] = $maxTimeProject;
$maxTimeProject->setProject($this);
}
return $this;
}
public function removeMaxTimeProject(MaxTimeProject $maxTimeProject): self
{
if ($this->maxTimeProjects->removeElement($maxTimeProject)) {
// set the owning side to null (unless already changed)
if ($maxTimeProject->getProject() === $this) {
$maxTimeProject->setProject(null);
}
}
return $this;
}
/**
* @return Collection|User[]
*/
public function getMember(): Collection
{
return $this->member;
}
public function addMember(User $member): self
{
if (!$this->member->contains($member)) {
$this->member[] = $member;
}
return $this;
}
public function removeMember(User $member): self
{
$this->member->removeElement($member);
return $this;
}
public function getDescriptionForUser(): ?string
{
return $this->descriptionForUser;
}
public function setDescriptionForUser(?string $descriptionForUser): self
{
$this->descriptionForUser = $descriptionForUser;
return $this;
}
public function getSlackChannelId(): ?string
{
return $this->SlackChannelId;
}
public function setSlackChannelId(?string $SlackChannelId): self
{
$this->SlackChannelId = $SlackChannelId;
return $this;
}
/**
* @return Collection|Task[]
*/
public function getTasks(): Collection
{
return $this->tasks;
}
public function addTask(Task $task): self
{
if (!$this->tasks->contains($task)) {
$this->tasks[] = $task;
$task->setProject($this);
}
return $this;
}
public function removeTask(Task $task): self
{
if ($this->tasks->removeElement($task)) {
// set the owning side to null (unless already changed)
if ($task->getProject() === $this) {
$task->setProject(null);
}
}
return $this;
}
/**
* @return Collection|RaportAds[]
*/
public function getRaportAds(): Collection
{
return $this->raportAds;
}
public function addRaportAd(RaportAds $raportAd): self
{
if (!$this->raportAds->contains($raportAd)) {
$this->raportAds[] = $raportAd;
$raportAd->setClient($this);
}
return $this;
}
public function removeRaportAd(RaportAds $raportAd): self
{
if ($this->raportAds->removeElement($raportAd)) {
// set the owning side to null (unless already changed)
if ($raportAd->getClient() === $this) {
$raportAd->setClient(null);
}
}
return $this;
}
public function getOfferPackage(): ?OfferPackage
{
return $this->offerPackage;
}
public function setOfferPackage(?OfferPackage $offerPackage): self
{
$this->offerPackage = $offerPackage;
return $this;
}
/**
* @return Collection|ProjectOfferPackage[]
*/
public function getProjectOfferPackages(): Collection
{
return $this->projectOfferPackages;
}
public function addProjectOfferPackage(ProjectOfferPackage $projectOfferPackage): self
{
if (!$this->projectOfferPackages->contains($projectOfferPackage)) {
$this->projectOfferPackages[] = $projectOfferPackage;
$projectOfferPackage->setProject($this);
}
return $this;
}
public function removeProjectOfferPackage(ProjectOfferPackage $projectOfferPackage): self
{
if ($this->projectOfferPackages->removeElement($projectOfferPackage)) {
// set the owning side to null (unless already changed)
if ($projectOfferPackage->getProject() === $this) {
$projectOfferPackage->setProject(null);
}
}
return $this;
}
public function getNumberAllegroAccount(): ?int
{
return $this->numberAllegroAccount;
}
public function setNumberAllegroAccount(?int $numberAllegroAccount): self
{
$this->numberAllegroAccount = $numberAllegroAccount;
return $this;
}
public function getType(): ?int
{
return $this->type;
}
public function setType(int $type): self
{
$this->type = $type;
return $this;
}
public function isDeactivated(): bool
{
return $this->type === self::TYPE_DEACTIVATE;
}
public function isActive(): bool
{
return $this->type === self::TYPE_ACTIVE;
}
public function getClientSlackChannelId(): ?string
{
return $this->clientSlackChannelId;
}
public function setClientSlackChannelId(?string $clientSlackChannelId): self
{
$this->clientSlackChannelId = $clientSlackChannelId;
return $this;
}
/**
* @return Collection|AllegroDataAds[]
*/
public function getAllegroDataAds(): Collection
{
return $this->allegroDataAds;
}
public function addAllegroDataAd(AllegroDataAds $allegroDataAd): self
{
if (!$this->allegroDataAds->contains($allegroDataAd)) {
$this->allegroDataAds[] = $allegroDataAd;
$allegroDataAd->setProject($this);
}
return $this;
}
public function removeAllegroDataAd(AllegroDataAds $allegroDataAd): self
{
if ($this->allegroDataAds->removeElement($allegroDataAd)) {
// set the owning side to null (unless already changed)
if ($allegroDataAd->getProject() === $this) {
$allegroDataAd->setProject(null);
}
}
return $this;
}
public function getAllegroAccount(): ?string
{
return $this->allegroAccount;
}
public function setAllegroAccount(?string $allegroAccount): self
{
$this->allegroAccount = $allegroAccount;
return $this;
}
public function getWantReturn(): ?float
{
return $this->wantReturn;
}
public function setWantReturn(?float $wantReturn): self
{
$this->wantReturn = $wantReturn;
return $this;
}
public function getAdsBudget(): ?float
{
return $this->adsBudget;
}
public function setAdsBudget(?float $adsBudget): self
{
$this->adsBudget = $adsBudget;
return $this;
}
public function getCategory(): ?int
{
return $this->category;
}
public function setCategory(?int $category): self
{
$this->category = $category;
return $this;
}
}