src/Entity/Project.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProjectRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ProjectRepository::class)
  9.  */
  10. class Project
  11. {
  12.     const TYPE_ACTIVE 1;
  13.     const TYPE_DEACTIVATE 2;
  14.     const CATEGORY_TYPE
  15.         = [
  16.             "allegro"    => self::CATEGORY_ALLEGRO,
  17.             "google ads" => self::CATEGORY_GOOGLE_ADS,
  18.             "fb ads"     => self::CATEGORY_FB_ADS,
  19.             "seo"        => self::CATEGORY_SEO,
  20.             "emag"        => self::CATEGORY_EMAG,
  21.         ];
  22.     const CATEGORY_ALLEGRO 1;
  23.     const CATEGORY_GOOGLE_ADS 2;
  24.     const CATEGORY_FB_ADS 3;
  25.     const CATEGORY_SEO 4;
  26.     const CATEGORY_EMAG 5;
  27.     /**
  28.      * @ORM\Id
  29.      * @ORM\GeneratedValue
  30.      * @ORM\Column(type="integer")
  31.      */
  32.     private $id;
  33.     /**
  34.      * @ORM\Column(type="string", length=255)
  35.      */
  36.     private $name;
  37.     /**
  38.      * @ORM\Column(type="text", nullable=true)
  39.      */
  40.     private $description;
  41.     /**
  42.      * @ORM\Column(type="float")
  43.      */
  44.     private $price;
  45.     /**
  46.      * @ORM\OneToMany(targetEntity=LoggedTime::class, mappedBy="project", cascade={"persist", "remove"})
  47.      */
  48.     private $times;
  49.     /**
  50.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="projects")
  51.      * @ORM\JoinColumn(nullable=true)
  52.      */
  53.     private $leader;
  54.     /**
  55.      * @ORM\ManyToMany(targetEntity=User::class, inversedBy="clientProjects")
  56.      * @ORM\JoinTable(name="client_project")
  57.      */
  58.     private $client;
  59.     /**
  60.      * @ORM\OneToMany(targetEntity=MaxTimeProject::class, mappedBy="project", cascade={"persist", "remove"})
  61.      */
  62.     private $maxTimeProjects;
  63.     /**
  64.      * @ORM\ManyToMany(targetEntity=User::class, inversedBy="myProjects")
  65.      */
  66.     private $member;
  67.     /**
  68.      * @ORM\Column(type="text", nullable=true)
  69.      */
  70.     private $descriptionForUser;
  71.     /**
  72.      * @ORM\Column(type="string", length=255, nullable=true)
  73.      */
  74.     private $SlackChannelId;
  75.     /**
  76.      * @ORM\OneToMany(targetEntity=Task::class, mappedBy="project", orphanRemoval=true)
  77.      */
  78.     private $tasks;
  79.     /**
  80.      * @ORM\OneToMany(targetEntity=RaportAds::class, mappedBy="client", orphanRemoval=true)
  81.      */
  82.     private $raportAds;
  83.     /**
  84.      * @ORM\ManyToOne(targetEntity=OfferPackage::class, inversedBy="projects")
  85.      */
  86.     private $offerPackage;
  87.     /**
  88.      * @ORM\OneToMany(targetEntity=ProjectOfferPackage::class, mappedBy="project", orphanRemoval=true)
  89.      */
  90.     private $projectOfferPackages;
  91.     /**
  92.      * @ORM\Column(type="integer", nullable=true)
  93.      */
  94.     private $numberAllegroAccount;
  95.     /**
  96.      * @ORM\Column(type="integer")
  97.      */
  98.     private $type;
  99.     /**
  100.      * @ORM\Column(type="string", length=255, nullable=true)
  101.      */
  102.     private $clientSlackChannelId;
  103.     /**
  104.      * @ORM\OneToMany(targetEntity=AllegroDataAds::class, mappedBy="project")
  105.      */
  106.     private $allegroDataAds;
  107.     /**
  108.      * @ORM\Column(type="text", nullable=true)
  109.      */
  110.     private $allegroAccount;
  111.     /**
  112.      * @ORM\Column(type="float", nullable=true)
  113.      */
  114.     private $wantReturn;
  115.     /**
  116.      * @ORM\Column(type="float", nullable=true)
  117.      */
  118.     private $adsBudget;
  119.     /**
  120.      * @ORM\Column(type="integer", nullable=true, options={"default": 1})
  121.      */
  122.     private $category;
  123.     /**
  124.      *
  125.      */
  126.     public function __construct()
  127.     {
  128.         $this->times = new ArrayCollection();
  129.         $this->client = new ArrayCollection();
  130.         $this->maxTimeProjects = new ArrayCollection();
  131.         $this->member = new ArrayCollection();
  132.         $this->tasks = new ArrayCollection();
  133.         $this->raportAds = new ArrayCollection();
  134.         $this->projectOfferPackages = new ArrayCollection();
  135.         $this->numberAllegroAccount 1;
  136.         $this->type self::TYPE_ACTIVE;
  137.         $this->allegroDataAds = new ArrayCollection();
  138.         $this->category self::CATEGORY_ALLEGRO;
  139.     }
  140.     /**
  141.      * @return int|null
  142.      */
  143.     public function getId(): ?int
  144.     {
  145.         return $this->id;
  146.     }
  147.     /**
  148.      * @return string|null
  149.      */
  150.     public function getName(): ?string
  151.     {
  152.         return $this->name;
  153.     }
  154.     /**
  155.      * @param string $name
  156.      *
  157.      * @return $this
  158.      */
  159.     public function setName(string $name): self
  160.     {
  161.         $this->name $name;
  162.         return $this;
  163.     }
  164.     /**
  165.      * @return string|null
  166.      */
  167.     public function getDescription(): ?string
  168.     {
  169.         return $this->description;
  170.     }
  171.     /**
  172.      * @param string $description
  173.      *
  174.      * @return $this
  175.      */
  176.     public function setDescription(string $description): self
  177.     {
  178.         $this->description $description;
  179.         return $this;
  180.     }
  181.     /**
  182.      * @return float|null
  183.      */
  184.     public function getPrice(): ?float
  185.     {
  186.         return $this->price;
  187.     }
  188.     /**
  189.      * @param float $price
  190.      *
  191.      * @return $this
  192.      */
  193.     public function setPrice(float $price): self
  194.     {
  195.         $this->price $price;
  196.         return $this;
  197.     }
  198.     /**
  199.      * @return Collection|LoggedTime[]
  200.      */
  201.     public function getTimes(): Collection
  202.     {
  203.         return $this->times;
  204.     }
  205.     /**
  206.      * @param LoggedTime $time
  207.      *
  208.      * @return $this
  209.      */
  210.     public function addTime(LoggedTime $time): self
  211.     {
  212.         if (!$this->times->contains($time)) {
  213.             $this->times[] = $time;
  214.             $time->setProject($this);
  215.         }
  216.         return $this;
  217.     }
  218.     /**
  219.      * @param LoggedTime $time
  220.      *
  221.      * @return $this
  222.      */
  223.     public function removeTime(LoggedTime $time): self
  224.     {
  225.         if ($this->times->removeElement($time)) {
  226.             // set the owning side to null (unless already changed)
  227.             if ($time->getProject() === $this) {
  228.                 $time->setProject(null);
  229.             }
  230.         }
  231.         return $this;
  232.     }
  233.     /**
  234.      * @return User|null
  235.      */
  236.     public function getLeader(): ?User
  237.     {
  238.         return $this->leader;
  239.     }
  240.     /**
  241.      * @param User|null $leader
  242.      *
  243.      * @return $this
  244.      */
  245.     public function setLeader(?User $leader): self
  246.     {
  247.         $this->leader $leader;
  248.         return $this;
  249.     }
  250.     /**
  251.      * @return Collection
  252.      */
  253.     public function getClient(): Collection
  254.     {
  255.         return $this->client;
  256.     }
  257.     public function addClient(User $member): self
  258.     {
  259.         if (!$this->client->contains($member)) {
  260.             $this->client[] = $member;
  261.         }
  262.         return $this;
  263.     }
  264.     public function removeClient(User $member): self
  265.     {
  266.         $this->client->removeElement($member);
  267.         return $this;
  268.     }
  269.     /**
  270.      * @return Collection|MaxTimeProject[]
  271.      */
  272.     public function getMaxTimeProjects(): Collection
  273.     {
  274.         return $this->maxTimeProjects;
  275.     }
  276.     public function addMaxTimeProject(MaxTimeProject $maxTimeProject): self
  277.     {
  278.         if (!$this->maxTimeProjects->contains($maxTimeProject)) {
  279.             $this->maxTimeProjects[] = $maxTimeProject;
  280.             $maxTimeProject->setProject($this);
  281.         }
  282.         return $this;
  283.     }
  284.     public function removeMaxTimeProject(MaxTimeProject $maxTimeProject): self
  285.     {
  286.         if ($this->maxTimeProjects->removeElement($maxTimeProject)) {
  287.             // set the owning side to null (unless already changed)
  288.             if ($maxTimeProject->getProject() === $this) {
  289.                 $maxTimeProject->setProject(null);
  290.             }
  291.         }
  292.         return $this;
  293.     }
  294.     /**
  295.      * @return Collection|User[]
  296.      */
  297.     public function getMember(): Collection
  298.     {
  299.         return $this->member;
  300.     }
  301.     public function addMember(User $member): self
  302.     {
  303.         if (!$this->member->contains($member)) {
  304.             $this->member[] = $member;
  305.         }
  306.         return $this;
  307.     }
  308.     public function removeMember(User $member): self
  309.     {
  310.         $this->member->removeElement($member);
  311.         return $this;
  312.     }
  313.     public function getDescriptionForUser(): ?string
  314.     {
  315.         return $this->descriptionForUser;
  316.     }
  317.     public function setDescriptionForUser(?string $descriptionForUser): self
  318.     {
  319.         $this->descriptionForUser $descriptionForUser;
  320.         return $this;
  321.     }
  322.     public function getSlackChannelId(): ?string
  323.     {
  324.         return $this->SlackChannelId;
  325.     }
  326.     public function setSlackChannelId(?string $SlackChannelId): self
  327.     {
  328.         $this->SlackChannelId $SlackChannelId;
  329.         return $this;
  330.     }
  331.     /**
  332.      * @return Collection|Task[]
  333.      */
  334.     public function getTasks(): Collection
  335.     {
  336.         return $this->tasks;
  337.     }
  338.     public function addTask(Task $task): self
  339.     {
  340.         if (!$this->tasks->contains($task)) {
  341.             $this->tasks[] = $task;
  342.             $task->setProject($this);
  343.         }
  344.         return $this;
  345.     }
  346.     public function removeTask(Task $task): self
  347.     {
  348.         if ($this->tasks->removeElement($task)) {
  349.             // set the owning side to null (unless already changed)
  350.             if ($task->getProject() === $this) {
  351.                 $task->setProject(null);
  352.             }
  353.         }
  354.         return $this;
  355.     }
  356.     /**
  357.      * @return Collection|RaportAds[]
  358.      */
  359.     public function getRaportAds(): Collection
  360.     {
  361.         return $this->raportAds;
  362.     }
  363.     public function addRaportAd(RaportAds $raportAd): self
  364.     {
  365.         if (!$this->raportAds->contains($raportAd)) {
  366.             $this->raportAds[] = $raportAd;
  367.             $raportAd->setClient($this);
  368.         }
  369.         return $this;
  370.     }
  371.     public function removeRaportAd(RaportAds $raportAd): self
  372.     {
  373.         if ($this->raportAds->removeElement($raportAd)) {
  374.             // set the owning side to null (unless already changed)
  375.             if ($raportAd->getClient() === $this) {
  376.                 $raportAd->setClient(null);
  377.             }
  378.         }
  379.         return $this;
  380.     }
  381.     public function getOfferPackage(): ?OfferPackage
  382.     {
  383.         return $this->offerPackage;
  384.     }
  385.     public function setOfferPackage(?OfferPackage $offerPackage): self
  386.     {
  387.         $this->offerPackage $offerPackage;
  388.         return $this;
  389.     }
  390.     /**
  391.      * @return Collection|ProjectOfferPackage[]
  392.      */
  393.     public function getProjectOfferPackages(): Collection
  394.     {
  395.         return $this->projectOfferPackages;
  396.     }
  397.     public function addProjectOfferPackage(ProjectOfferPackage $projectOfferPackage): self
  398.     {
  399.         if (!$this->projectOfferPackages->contains($projectOfferPackage)) {
  400.             $this->projectOfferPackages[] = $projectOfferPackage;
  401.             $projectOfferPackage->setProject($this);
  402.         }
  403.         return $this;
  404.     }
  405.     public function removeProjectOfferPackage(ProjectOfferPackage $projectOfferPackage): self
  406.     {
  407.         if ($this->projectOfferPackages->removeElement($projectOfferPackage)) {
  408.             // set the owning side to null (unless already changed)
  409.             if ($projectOfferPackage->getProject() === $this) {
  410.                 $projectOfferPackage->setProject(null);
  411.             }
  412.         }
  413.         return $this;
  414.     }
  415.     public function getNumberAllegroAccount(): ?int
  416.     {
  417.         return $this->numberAllegroAccount;
  418.     }
  419.     public function setNumberAllegroAccount(?int $numberAllegroAccount): self
  420.     {
  421.         $this->numberAllegroAccount $numberAllegroAccount;
  422.         return $this;
  423.     }
  424.     public function getType(): ?int
  425.     {
  426.         return $this->type;
  427.     }
  428.     public function setType(int $type): self
  429.     {
  430.         $this->type $type;
  431.         return $this;
  432.     }
  433.     public function isDeactivated(): bool
  434.     {
  435.         return $this->type === self::TYPE_DEACTIVATE;
  436.     }
  437.     public function isActive(): bool
  438.     {
  439.         return $this->type === self::TYPE_ACTIVE;
  440.     }
  441.     public function getClientSlackChannelId(): ?string
  442.     {
  443.         return $this->clientSlackChannelId;
  444.     }
  445.     public function setClientSlackChannelId(?string $clientSlackChannelId): self
  446.     {
  447.         $this->clientSlackChannelId $clientSlackChannelId;
  448.         return $this;
  449.     }
  450.     /**
  451.      * @return Collection|AllegroDataAds[]
  452.      */
  453.     public function getAllegroDataAds(): Collection
  454.     {
  455.         return $this->allegroDataAds;
  456.     }
  457.     public function addAllegroDataAd(AllegroDataAds $allegroDataAd): self
  458.     {
  459.         if (!$this->allegroDataAds->contains($allegroDataAd)) {
  460.             $this->allegroDataAds[] = $allegroDataAd;
  461.             $allegroDataAd->setProject($this);
  462.         }
  463.         return $this;
  464.     }
  465.     public function removeAllegroDataAd(AllegroDataAds $allegroDataAd): self
  466.     {
  467.         if ($this->allegroDataAds->removeElement($allegroDataAd)) {
  468.             // set the owning side to null (unless already changed)
  469.             if ($allegroDataAd->getProject() === $this) {
  470.                 $allegroDataAd->setProject(null);
  471.             }
  472.         }
  473.         return $this;
  474.     }
  475.     public function getAllegroAccount(): ?string
  476.     {
  477.         return $this->allegroAccount;
  478.     }
  479.     public function setAllegroAccount(?string $allegroAccount): self
  480.     {
  481.         $this->allegroAccount $allegroAccount;
  482.         return $this;
  483.     }
  484.     public function getWantReturn(): ?float
  485.     {
  486.         return $this->wantReturn;
  487.     }
  488.     public function setWantReturn(?float $wantReturn): self
  489.     {
  490.         $this->wantReturn $wantReturn;
  491.         return $this;
  492.     }
  493.     public function getAdsBudget(): ?float
  494.     {
  495.         return $this->adsBudget;
  496.     }
  497.     public function setAdsBudget(?float $adsBudget): self
  498.     {
  499.         $this->adsBudget $adsBudget;
  500.         return $this;
  501.     }
  502.     public function getCategory(): ?int
  503.     {
  504.         return $this->category;
  505.     }
  506.     public function setCategory(?int $category): self
  507.     {
  508.         $this->category $category;
  509.         return $this;
  510.     }
  511. }