src/Entity/FilmProject.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FilmProjectRepository;
  4. use App\String\Constant;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use JMS\Serializer\Annotation\Exclude;
  10. use JMS\Serializer\Annotation\MaxDepth;
  11. #[ORM\Entity(repositoryClassFilmProjectRepository::class)]
  12. class FilmProject
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column(type'integer')]
  17.     private $id;
  18.     #[MaxDepth(1)]
  19.     #[ORM\OneToMany(mappedBy'filmProject'targetEntityFilmProjectMember::class, cascade: ['persist''remove'])]
  20.     private $filmProjectMembers;
  21.     #[MaxDepth(1)]
  22.     #[ORM\Column(type'string'length255nullabletrue)]
  23.     private $title;
  24.     #[MaxDepth(1)]
  25.     #[ORM\Column(type'string'length255nullabletrue)]
  26.     private $productionStage;
  27.     #[MaxDepth(1)]
  28.     #[ORM\Column(type'string'length255nullabletrue)]
  29.     private $productionType;
  30.     #[MaxDepth(1)]
  31.     #[ORM\OneToOne(mappedBy'filmProject'targetEntityFilmProjectDetails::class, cascade: ['persist''remove'])]
  32.     private $filmProjectDetails;
  33.     #[MaxDepth(1)]
  34.     #[ORM\OneToOne(mappedBy'filmProject'targetEntityFilmProjectStoryImpact::class, cascade: ['persist''remove'])]
  35.     private $filmProjectStoryImpact;
  36.     #[MaxDepth(1)]
  37.     #[ORM\OneToOne(mappedBy'filmProject'targetEntityFilmProjectTimeline::class, cascade: ['persist''remove'])]
  38.     private $filmProjectTimeline;
  39.     #[MaxDepth(1)]
  40.     #[ORM\OneToOne(mappedBy'filmProject'targetEntityFilmProjectFunding::class, cascade: ['persist''remove'])]
  41.     private $filmProjectFunding;
  42.     #[MaxDepth(1)]
  43.     #[ORM\Column(type'string'length255)]
  44.     private $status;
  45.     #[MaxDepth(1)]
  46.     #[Exclude()]
  47.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'filmProjects')]
  48.     private $owner;
  49.     #[MaxDepth(1)]
  50.     #[Exclude()]
  51.     #[ORM\OneToOne(targetEntityOrderDetails::class, cascade: ['persist''remove'])]
  52.     private $orderDetails;
  53.     #[MaxDepth(1)]
  54.     #[ORM\OneToOne(targetEntityFilmProjectMember::class, cascade: ['persist''remove'] )]
  55.     private $filmProjectAdmin;
  56.     #[MaxDepth(1)]
  57.     #[ORM\OneToOne(targetEntityFilmProjectMember::class, cascade: ['persist''remove'])]
  58.     private $filmProjectProducer;
  59.     #[MaxDepth(1)]
  60.     #[ORM\OneToOne(targetEntityFilmProjectMember::class, cascade: ['persist''remove'])]
  61.     private $filmProjectDirector;
  62.     #[MaxDepth(1)]
  63.     #[ORM\Column(type'integer'nullabletrue)]
  64.     private $wordpressId;
  65.     
  66.     #[MaxDepth(1)]
  67.     #[ORM\Column(length255nullabletrue)]
  68.     private ?string $wordpressStatus null;
  69.     #[MaxDepth(1)]
  70.     #[ORM\Column(type'string'length255nullabletrue)]
  71.     private $salesforceId;
  72.     #[MaxDepth(1)]
  73.     #[ORM\Column(type'text'nullabletrue)]
  74.     private $note;
  75.     #[MaxDepth(1)]
  76.     #[ORM\Column(type'integer'nullabletrue)]
  77.     private $resubmitCount;
  78.     #[MaxDepth(1)]
  79.     #[ORM\ManyToOne(targetEntityProduct::class, inversedBy'filmProjects')]
  80.     private $product;
  81.     #[MaxDepth(1)]
  82.     #[ORM\Column(type'datetime'nullabletrue)]
  83.     private $createdAt;
  84.     #[MaxDepth(1)]
  85.     #[ORM\Column(type'datetime'nullabletrue)]
  86.     private $modifiedAt;
  87.     #[MaxDepth(1)]
  88.     #[ORM\OneToMany(mappedBy'filmProject'targetEntityDonation::class, cascade: ['persist''remove'])]
  89.     private $donations;
  90.     #[MaxDepth(1)]
  91.     #[ORM\Column(type'float'nullabletrue)]
  92.     private $totalDonation;
  93.     #[MaxDepth(1)]
  94.     #[ORM\Column(type'string'length255nullabletrue)]
  95.     private $trackingOptionId;
  96.     #[Exclude()]
  97.     #[ORM\OneToOne(mappedBy'filmProject'targetEntityFilmProjectOriginal::class, cascade: ['persist''remove'])]
  98.     private $filmProjectOriginal;
  99.     #[Exclude()]
  100.     #[ORM\ManyToMany(targetEntityUser::class, mappedBy'followedFilmProjects')]
  101.     private $users;
  102.     #[Exclude()]
  103.     #[ORM\OneToMany(mappedBy'filmProject'targetEntityFilmProjectUpdate::class, cascade: ['persist''remove'])]
  104.     private Collection $filmProjectUpdates;
  105.     #[Exclude()]
  106.     #[ORM\OneToMany(mappedBy'filmProject'targetEntityFilmProjectImage::class, cascade: ['persist''remove'])]
  107.     private Collection $filmProjectImages;
  108.     #[Exclude()]
  109.     #[ORM\OneToMany(mappedBy'filmProject'targetEntityFilmProjectSponsor::class, cascade: ['persist''remove'])]
  110.     private Collection $filmProjectSponsors;
  111.     #[ORM\Column(nullabletrue)]
  112.     private ?int $tabActive null;
  113.     #[ORM\Column(nullabletrue)]
  114.     private ?bool $isHideDonationBox null;
  115.     #[ORM\Column(length255nullabletrue)]
  116.     private ?string $wordpressPassword null;
  117.     #[ORM\Column(nullabletrue)]
  118.     private ?int $oldWordpressId null;
  119.     #[ORM\Column(nullabletrue)]
  120.     private ?bool $isDafCore null;
  121.     #[ORM\Column(nullabletrue)]
  122.     private ?bool $isDafProgram null;
  123.     #[ORM\Column(length255nullabletrue)]
  124.     private ?string $xeroId null;    
  125.     #[ORM\OneToMany(mappedBy'filmProject'targetEntityFilmProjectChangeHistory::class)]
  126.     private Collection $filmProjectChangeHistories;
  127.     #[ORM\OneToMany(mappedBy'filmProject'targetEntityFilmProjectProgressReport::class)]
  128.     private Collection $filmProjectProgressReports;
  129.     #[ORM\ManyToOne(inversedBy'recurringFilmProjects')]
  130.     private ?Product $recurringProduct null;
  131.     #[ORM\Column(nullabletrue)]
  132.     private ?bool $isProgressReportActive null;
  133.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  134.     private ?\DateTimeInterface $progressReportStartDate null;
  135.     #[ORM\Column(nullabletrue)]
  136.     private ?int $currentProgressReportYear null;
  137.     #[ORM\Column(nullabletrue)]
  138.     private ?\DateTime $projectApprovalDate null;
  139.     public function __construct()
  140.     {
  141.         $this->filmProjectMembers = new ArrayCollection();
  142.         $this->donations = new ArrayCollection();
  143.         $this->users = new ArrayCollection();
  144.         $this->filmProjectUpdates = new ArrayCollection();
  145.         $this->filmProjectImages = new ArrayCollection();
  146.         $this->filmProjectSponsors = new ArrayCollection();
  147.     }
  148.     public function getId(): ?int
  149.     {
  150.         return $this->id;
  151.     }
  152.     /**
  153.      * @return Collection<int, FilmProjectMember>
  154.      */
  155.     public function getFilmProjectMembers(): Collection
  156.     {
  157.         return $this->filmProjectMembers;
  158.     }
  159.     public function addFilmProjectMember(FilmProjectMember $filmProjectMember): self
  160.     {
  161.         if (!$this->filmProjectMembers->contains($filmProjectMember)) {
  162.             $this->filmProjectMembers[] = $filmProjectMember;
  163.             $filmProjectMember->setFilmProject($this);
  164.         }
  165.         return $this;
  166.     }
  167.     public function removeFilmProjectMember(FilmProjectMember $filmProjectMember): self
  168.     {
  169.         if ($this->filmProjectMembers->removeElement($filmProjectMember)) {
  170.             // set the owning side to null (unless already changed)
  171.             if ($filmProjectMember->getFilmProject() === $this) {
  172.                 $filmProjectMember->setFilmProject(null);
  173.             }
  174.         }
  175.         return $this;
  176.     }
  177.     public function getTitle(): ?string
  178.     {
  179.         return $this->title;
  180.     }
  181.     public function setTitle(?string $title): self
  182.     {
  183.         $this->title $title;
  184.         return $this;
  185.     }
  186.     public function getProductionStage(): ?string
  187.     {
  188.         return $this->productionStage;
  189.     }
  190.     public function setProductionStage(?string $productionStage): self
  191.     {
  192.         $this->productionStage $productionStage;
  193.         return $this;
  194.     }
  195.     public function getProductionStageWordpress(): ?string
  196.     {
  197.         if ($this->productionStage == 'Post-Production') {
  198.             return 'Post-production';
  199.         } elseif ($this->productionStage == 'Film Complete') {
  200.             return 'Film Completed';
  201.         }
  202.         return $this->productionStage;
  203.     }
  204.     public function getProductionType(): ?string
  205.     {
  206.         return $this->productionType;
  207.     }
  208.     public function setProductionType(?string $productionType): self
  209.     {
  210.         $this->productionType $productionType;
  211.         return $this;
  212.     }
  213.     public function getFilmProjectDetails(): ?FilmProjectDetails
  214.     {
  215.         return $this->filmProjectDetails;
  216.     }
  217.     public function setFilmProjectDetails(?FilmProjectDetails $filmProjectDetails): self
  218.     {
  219.         // unset the owning side of the relation if necessary
  220.         if ($filmProjectDetails === null && $this->filmProjectDetails !== null) {
  221.             $this->filmProjectDetails->setFilmProject(null);
  222.         }
  223.         // set the owning side of the relation if necessary
  224.         if ($filmProjectDetails !== null && $filmProjectDetails->getFilmProject() !== $this) {
  225.             $filmProjectDetails->setFilmProject($this);
  226.         }
  227.         $this->filmProjectDetails $filmProjectDetails;
  228.         return $this;
  229.     }
  230.     public function getFilmProjectStoryImpact(): ?FilmProjectStoryImpact
  231.     {
  232.         return $this->filmProjectStoryImpact;
  233.     }
  234.     public function setFilmProjectStoryImpact(?FilmProjectStoryImpact $filmProjectStoryImpact): self
  235.     {
  236.         // unset the owning side of the relation if necessary
  237.         if ($filmProjectStoryImpact === null && $this->filmProjectStoryImpact !== null) {
  238.             $this->filmProjectStoryImpact->setFilmProject(null);
  239.         }
  240.         // set the owning side of the relation if necessary
  241.         if ($filmProjectStoryImpact !== null && $filmProjectStoryImpact->getFilmProject() !== $this) {
  242.             $filmProjectStoryImpact->setFilmProject($this);
  243.         }
  244.         $this->filmProjectStoryImpact $filmProjectStoryImpact;
  245.         return $this;
  246.     }
  247.     public function getFilmProjectTimeline(): ?FilmProjectTimeline
  248.     {
  249.         return $this->filmProjectTimeline;
  250.     }
  251.     public function setFilmProjectTimeline(?FilmProjectTimeline $filmProjectTimeline): self
  252.     {
  253.         // unset the owning side of the relation if necessary
  254.         if ($filmProjectTimeline === null && $this->filmProjectTimeline !== null) {
  255.             $this->filmProjectTimeline->setFilmProject(null);
  256.         }
  257.         // set the owning side of the relation if necessary
  258.         if ($filmProjectTimeline !== null && $filmProjectTimeline->getFilmProject() !== $this) {
  259.             $filmProjectTimeline->setFilmProject($this);
  260.         }
  261.         $this->filmProjectTimeline $filmProjectTimeline;
  262.         return $this;
  263.     }
  264.     public function getFilmProjectFunding(): ?FilmProjectFunding
  265.     {
  266.         return $this->filmProjectFunding;
  267.     }
  268.     public function setFilmProjectFunding(?FilmProjectFunding $filmProjectFunding): self
  269.     {
  270.         // unset the owning side of the relation if necessary
  271.         if ($filmProjectFunding === null && $this->filmProjectFunding !== null) {
  272.             $this->filmProjectFunding->setFilmProject(null);
  273.         }
  274.         // set the owning side of the relation if necessary
  275.         if ($filmProjectFunding !== null && $filmProjectFunding->getFilmProject() !== $this) {
  276.             $filmProjectFunding->setFilmProject($this);
  277.         }
  278.         $this->filmProjectFunding $filmProjectFunding;
  279.         return $this;
  280.     }
  281.     public function getStatus(): ?string
  282.     {
  283.         return $this->status;
  284.     }
  285.     public function setStatus(string $status): self
  286.     {
  287.         $this->status $status;
  288.         return $this;
  289.     }
  290.     public function getOwner(): ?User
  291.     {
  292.         return $this->owner;
  293.     }
  294.     public function setOwner(?User $owner): self
  295.     {
  296.         $this->owner $owner;
  297.         return $this;
  298.     }
  299.     public function getOrder()
  300.     {
  301.         return 'not set';
  302.     }
  303.     public function getOrderDetails(): ?OrderDetails
  304.     {
  305.         return $this->orderDetails;
  306.     }
  307.     public function setOrderDetails(?OrderDetails $orderDetails): self
  308.     {
  309.         $this->orderDetails $orderDetails;
  310.         return $this;
  311.     }
  312.     public function getFilmProjectAdmin(): ?FilmProjectMember
  313.     {
  314.         return $this->filmProjectAdmin;
  315.     }
  316.     public function setFilmProjectAdmin(?FilmProjectMember $filmProjectAdmin): self
  317.     {
  318.         $this->filmProjectAdmin $filmProjectAdmin;
  319.         return $this;
  320.     }
  321.     public function getFilmProjectProducer(): ?FilmProjectMember
  322.     {
  323.         return $this->filmProjectProducer;
  324.     }
  325.     public function setFilmProjectProducer(?FilmProjectMember $filmProjectProducer): self
  326.     {
  327.         $this->filmProjectProducer $filmProjectProducer;
  328.         return $this;
  329.     }
  330.     public function getFilmProjectDirector(): ?FilmProjectMember
  331.     {
  332.         return $this->filmProjectDirector;
  333.     }
  334.     public function setFilmProjectDirector(?FilmProjectMember $filmProjectDirector): self
  335.     {
  336.         $this->filmProjectDirector $filmProjectDirector;
  337.         return $this;
  338.     }
  339.     public function getWordpressId(): ?int
  340.     {
  341.         return $this->wordpressId;
  342.     }
  343.     public function setWordpressId(?int $wordpressId): self
  344.     {
  345.         $this->wordpressId $wordpressId;
  346.         return $this;
  347.     }
  348.     public function getSalesforceId(): ?string
  349.     {
  350.         return $this->salesforceId;
  351.     }
  352.     public function setSalesforceId(?string $salesforceId): self
  353.     {
  354.         $this->salesforceId $salesforceId;
  355.         return $this;
  356.     }
  357.     public function getNote(): ?string
  358.     {
  359.         return $this->note;
  360.     }
  361.     public function setNote(?string $note): self
  362.     {
  363.         $this->note $note;
  364.         return $this;
  365.     }
  366.     public function getResubmitCount(): ?int
  367.     {
  368.         return $this->resubmitCount;
  369.     }
  370.     public function setResubmitCount(?int $resubmitCount): self
  371.     {
  372.         $this->resubmitCount $resubmitCount;
  373.         return $this;
  374.     }
  375.     public function getProduct(): ?Product
  376.     {
  377.         return $this->product;
  378.     }
  379.     public function setProduct(?Product $product): self
  380.     {
  381.         $this->product $product;
  382.         return $this;
  383.     }
  384.     public function getCreatedAt(): ?\DateTimeInterface
  385.     {
  386.         return $this->createdAt;
  387.     }
  388.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  389.     {
  390.         $this->createdAt $createdAt;
  391.         return $this;
  392.     }
  393.     public function getModifiedAt(): ?\DateTimeInterface
  394.     {
  395.         return $this->modifiedAt;
  396.     }
  397.     public function setModifiedAt(?\DateTimeInterface $modifiedAt): self
  398.     {
  399.         $this->modifiedAt $modifiedAt;
  400.         return $this;
  401.     }
  402.     /**
  403.      * @return Collection<int, Donation>
  404.      */
  405.     public function getDonations(): Collection
  406.     {
  407.         return $this->donations;
  408.     }
  409.     public function addDonation(Donation $donation): self
  410.     {
  411.         if (!$this->donations->contains($donation)) {
  412.             $this->donations[] = $donation;
  413.             $donation->setFilmProject($this);
  414.         }
  415.         return $this;
  416.     }
  417.     public function removeDonation(Donation $donation): self
  418.     {
  419.         if ($this->donations->removeElement($donation)) {
  420.             // set the owning side to null (unless already changed)
  421.             if ($donation->getFilmProject() === $this) {
  422.                 $donation->setFilmProject(null);
  423.             }
  424.         }
  425.         return $this;
  426.     }    
  427.     
  428.     public function getTotalDonation(): ?float
  429.     {
  430.         return $this->totalDonation;
  431.     }
  432.     public function setTotalDonation(?float $totalDonation): self
  433.     {
  434.         $this->totalDonation $totalDonation;
  435.         return $this;
  436.     }
  437.     // Add other functionalities below
  438.     public function addTotalDonation(float $amount): self
  439.     {
  440.         $this->totalDonation += $amount;
  441.         return $this;
  442.     }
  443.     public function reduceTotalDonation(float $amount): self
  444.     {
  445.         $this->totalDonation -= $amount;
  446.         return $this;
  447.     }
  448.     public function toString()
  449.     {
  450.         if ($this->title) {
  451.             return $this->title;
  452.         }
  453.         return '';
  454.     }
  455.     public function __toString()
  456.     {
  457.         return $this->toString();
  458.     }
  459.     public function getTrackingOptionId(): ?string
  460.     {
  461.         return $this->trackingOptionId;
  462.     }
  463.     public function setTrackingOptionId(?string $trackingOptionId): self
  464.     {
  465.         $this->trackingOptionId $trackingOptionId;
  466.         return $this;
  467.     }
  468.     public function getFilmProjectOriginal(): ?FilmProjectOriginal
  469.     {
  470.         return $this->filmProjectOriginal;
  471.     }
  472.     public function setFilmProjectOriginal(?FilmProjectOriginal $filmProjectOriginal): self
  473.     {
  474.         // unset the owning side of the relation if necessary
  475.         if ($filmProjectOriginal === null && $this->filmProjectOriginal !== null) {
  476.             $this->filmProjectOriginal->setFilmProject(null);
  477.         }
  478.         // set the owning side of the relation if necessary
  479.         if ($filmProjectOriginal !== null && $filmProjectOriginal->getFilmProject() !== $this) {
  480.             $filmProjectOriginal->setFilmProject($this);
  481.         }
  482.         $this->filmProjectOriginal $filmProjectOriginal;
  483.         return $this;
  484.     }
  485.     /**
  486.      * @return Collection<int, User>
  487.      */
  488.     public function getUsers(): Collection
  489.     {
  490.         return $this->users;
  491.     }
  492.     public function addUser(User $user): self
  493.     {
  494.         if (!$this->users->contains($user)) {
  495.             $this->users[] = $user;
  496.             $user->addFollowedFilmProject($this);
  497.         }
  498.         return $this;
  499.     }
  500.     public function removeUser(User $user): self
  501.     {
  502.         if ($this->users->removeElement($user)) {
  503.             $user->removeFollowedFilmProject($this);
  504.         }
  505.         return $this;
  506.     }
  507.     /**
  508.      * @return Collection<int, FilmProjectUpdate>
  509.      */
  510.     public function getFilmProjectUpdates(): Collection
  511.     {
  512.         return $this->filmProjectUpdates;
  513.     }
  514.     public function addFilmProjectUpdate(FilmProjectUpdate $filmProjectUpdate): self
  515.     {
  516.         if (!$this->filmProjectUpdates->contains($filmProjectUpdate)) {
  517.             $this->filmProjectUpdates->add($filmProjectUpdate);
  518.             $filmProjectUpdate->setFilmProject($this);
  519.         }
  520.         return $this;
  521.     }
  522.     public function removeFilmProjectUpdate(FilmProjectUpdate $filmProjectUpdate): self
  523.     {
  524.         if ($this->filmProjectUpdates->removeElement($filmProjectUpdate)) {
  525.             // set the owning side to null (unless already changed)
  526.             if ($filmProjectUpdate->getFilmProject() === $this) {
  527.                 $filmProjectUpdate->setFilmProject(null);
  528.             }
  529.         }
  530.         return $this;
  531.     }
  532.     public function getWordpressUrl(): string
  533.     {
  534.         $url '';
  535.         if ($this->wordpressId) {
  536.             $url Constant::WORDPRESS_URL '?page_id='$this->wordpressId;
  537.         }
  538.         return $url;
  539.     }
  540.     public function getWordpressDraftUrl(): string
  541.     {
  542.         $url '';
  543.         if ($this->wordpressId) {
  544.             $url Constant::WORDPRESS_URL '/admin-dashboard?redirect_to='urlencode("/?post_type=project&p="). $this->wordpressId;
  545.         }
  546.         return $url;
  547.     }
  548.     public function getFundingStatus(): string
  549.     {
  550.         $fundingStatus '-';
  551.         $currentFunding 0;
  552.         if ($this->totalDonation) {
  553.             $currentFunding '$'number_format($this->totalDonation 1002'.'',');
  554.         }
  555.         $totalDonation 0;
  556.         if($this->donations) {
  557.             $invoiceIdArr = [];
  558.             foreach ($this->donations as $donation) {
  559.                 $orderDetails $donation->getOrderDetails();
  560.                 $paymentDetails $orderDetails->getPaymentDetails();
  561.                 if (in_array($orderDetails->getInvoiceNumber(), $invoiceIdArr) || $paymentDetails->getStatus() != Constant::PAYMENT_STATUS_PAID) {
  562.                     continue;
  563.                 }
  564.                 $totalDonation += $orderDetails->getTotal();
  565.                 
  566.                 // Need to exclude popup amount if there is one
  567.                 $supportdaf $donation->getSupportDaf();
  568.                 if ($supportdaf) { 
  569.                     $totalDonation -= $supportdaf;
  570.                 }
  571.                 // Add invoice Number
  572.                 if ($orderDetails->getInvoiceNumber()) {
  573.                     array_push($invoiceIdArr$orderDetails->getInvoiceNumber());
  574.                 }
  575.             }
  576.             $currentFunding '$'number_format($totalDonation 1002'.'',');
  577.         }
  578.         if ($this->filmProjectFunding) {
  579.             if ($this->filmProjectFunding->getFundraisingGoal()) {
  580.                 $goal $this->filmProjectFunding->getFundraisingGoal() / 100;
  581.                 $goal '$'number_format($goal2'.'',');
  582.                 $fundingStatus $currentFunding .' / '$goal;
  583.             } else {
  584.                 return $fundingStatus;
  585.             }
  586.         }
  587.         return $fundingStatus;
  588.     }
  589.     public function getWordpressStatus(): ?string
  590.     {
  591.         return $this->wordpressStatus;
  592.     }
  593.     public function setWordpressStatus(?string $wordpressStatus): self
  594.     {
  595.         $this->wordpressStatus $wordpressStatus;
  596.         return $this;
  597.     }
  598.     public function teamMemberRole()
  599.     {
  600.         $role 'testing';
  601.         return $role;
  602.     }
  603.     /**
  604.      * @return Collection<int, FilmProjectImage>
  605.      */
  606.     public function getFilmProjectImages(): Collection
  607.     {
  608.         return $this->filmProjectImages;
  609.     }
  610.     public function addFilmProjectImage(FilmProjectImage $filmProjectImage): self
  611.     {
  612.         if (!$this->filmProjectImages->contains($filmProjectImage)) {
  613.             $this->filmProjectImages->add($filmProjectImage);
  614.             $filmProjectImage->setFilmProject($this);
  615.         }
  616.         return $this;
  617.     }
  618.     public function removeFilmProjectImage(FilmProjectImage $filmProjectImage): self
  619.     {
  620.         if ($this->filmProjectImages->removeElement($filmProjectImage)) {
  621.             // set the owning side to null (unless already changed)
  622.             if ($filmProjectImage->getFilmProject() === $this) {
  623.                 $filmProjectImage->setFilmProject(null);
  624.             }
  625.         }
  626.         return $this;
  627.     }
  628.     /**
  629.      * @return Collection<int, FilmProjectSponsor>
  630.      */
  631.     public function getFilmProjectSponsors(): Collection
  632.     {
  633.         return $this->filmProjectSponsors;
  634.     }
  635.     public function addFilmProjectSponsor(FilmProjectSponsor $filmProjectSponsor): self
  636.     {
  637.         if (!$this->filmProjectSponsors->contains($filmProjectSponsor)) {
  638.             $this->filmProjectSponsors->add($filmProjectSponsor);
  639.             $filmProjectSponsor->setFilmProject($this);
  640.         }
  641.         return $this;
  642.     }
  643.     public function removeFilmProjectSponsor(FilmProjectSponsor $filmProjectSponsor): self
  644.     {
  645.         if ($this->filmProjectSponsors->removeElement($filmProjectSponsor)) {
  646.             // set the owning side to null (unless already changed)
  647.             if ($filmProjectSponsor->getFilmProject() === $this) {
  648.                 $filmProjectSponsor->setFilmProject(null);
  649.             }
  650.         }
  651.         return $this;
  652.     }
  653.     /**
  654.      * Returning all project team members
  655.      *
  656.      * @return array
  657.      */
  658.     public function getAllMembers(): array
  659.     {
  660.         $filmProjectTeam = [];
  661.         $filmAdmin $this->getFilmProjectAdmin();
  662.         $filmProducer $this->getFilmProjectProducer();
  663.         $filmDirector $this->getFilmProjectDirector();
  664.         $filmProjectTeam = [$filmAdmin$filmProducer$filmDirector];
  665.         foreach($this->getFilmProjectMembers() as $filmProjectMember) {
  666.             array_push($filmProjectTeam$filmProjectMember);
  667.         }
  668.         return $filmProjectTeam;
  669.     }
  670.     public function getTabActive(): ?int
  671.     {
  672.         return $this->tabActive;
  673.     }
  674.     public function setTabActive(?int $tabActive): self
  675.     {
  676.         $this->tabActive $tabActive;
  677.         return $this;
  678.     }
  679.     public function isIsHideDonationBox(): ?bool
  680.     {
  681.         return $this->isHideDonationBox;
  682.     }
  683.     public function setIsHideDonationBox(?bool $isHideDonationBox): self
  684.     {
  685.         $this->isHideDonationBox $isHideDonationBox;
  686.         return $this;
  687.     }
  688.     
  689.     public function getWordpressPassword(): ?string
  690.     {
  691.         return $this->wordpressPassword;
  692.     }
  693.     public function setWordpressPassword(?string $wordpressPassword): self
  694.     {
  695.         $this->wordpressPassword $wordpressPassword;
  696.         return $this;
  697.     }
  698.     public function getOldWordpressId(): ?int
  699.     {
  700.         return $this->oldWordpressId;
  701.     }
  702.     public function setOldWordpressId(?int $oldWordpressId): self
  703.     {
  704.         $this->oldWordpressId $oldWordpressId;
  705.         return $this;
  706.     }
  707.     public function isIsDafCore(): ?bool
  708.     {
  709.         return $this->isDafCore;
  710.     }
  711.     public function setIsDafCore(?bool $isDafCore): self
  712.     {
  713.         $this->isDafCore $isDafCore;
  714.         return $this;
  715.     }
  716.     public function isIsDafProgram(): ?bool
  717.     {
  718.         return $this->isDafProgram;
  719.     }
  720.     public function setIsDafProgram(?bool $isDafProgram): self
  721.     {
  722.         $this->isDafProgram $isDafProgram;
  723.         return $this;
  724.     }
  725.     public function getXeroId(): ?string
  726.     {
  727.         return $this->xeroId;
  728.     }
  729.     public function setXeroId(?string $xeroId): static
  730.     {
  731.         $this->xeroId $xeroId;
  732.         return $this;
  733.     }
  734.      /**
  735.      * @return Collection<int, FilmProjectChangeHistory>
  736.      */
  737.     public function getFilmProjectChangeHistories(): Collection
  738.     {
  739.         return $this->filmProjectChangeHistories;
  740.     }
  741.     public function addFilmProjectChangeHistory(FilmProjectChangeHistory $filmProjectChangeHistory): static
  742.     {
  743.         if (!$this->filmProjectChangeHistories->contains($filmProjectChangeHistory)) {
  744.             $this->filmProjectChangeHistories->add($filmProjectChangeHistory);
  745.             $filmProjectChangeHistory->setFilmProject($this);
  746.         }
  747.         return $this;
  748.     }
  749.     public function removeFilmProjectChangeHistory(FilmProjectChangeHistory $filmProjectChangeHistory): static
  750.     {
  751.         if ($this->filmProjectChangeHistories->removeElement($filmProjectChangeHistory)) {
  752.             // set the owning side to null (unless already changed)
  753.             if ($filmProjectChangeHistory->getFilmProject() === $this) {
  754.                 $filmProjectChangeHistory->setFilmProject(null);
  755.             }
  756.         }
  757.         return $this;
  758.     }
  759.     /**
  760.      * @return Collection<int, FilmProjectProgressReport>
  761.      */
  762.     public function getFilmProjectProgressReports(): Collection
  763.     {
  764.         return $this->filmProjectProgressReports;
  765.     }
  766.     public function addFilmProjectProgressReport(FilmProjectProgressReport $filmProjectProgressReport): static
  767.     {
  768.         if (!$this->filmProjectProgressReports->contains($filmProjectProgressReport)) {
  769.             $this->filmProjectProgressReports->add($filmProjectProgressReport);
  770.             $filmProjectProgressReport->setFilmProject($this);
  771.         }
  772.         return $this;
  773.     }
  774.     public function removeFilmProjectProgressReport(FilmProjectProgressReport $filmProjectProgressReport): static
  775.     {
  776.         if ($this->filmProjectProgressReports->removeElement($filmProjectProgressReport)) {
  777.             // set the owning side to null (unless already changed)
  778.             if ($filmProjectProgressReport->getFilmProject() === $this) {
  779.                 $filmProjectProgressReport->setFilmProject(null);
  780.             }
  781.         }
  782.         return $this;
  783.     }
  784.     public function getProgressReportStatus() {
  785.         $progressReports $this->filmProjectProgressReports;
  786.         $currentYear = (int) date('Y');
  787.         foreach ($progressReports as $progressReport) {
  788.             $progressReportYear = (int) ($progressReport->getCreatedAt())->format('Y');
  789.             if ($currentYear === $progressReportYear && $progressReport->getStatus() == 'completed') {
  790.                 return true;
  791.             }
  792.         }
  793.         return false;
  794.     }
  795.     public function getProgressReportStatusUpdate() {
  796.         $progressReports $this->filmProjectProgressReports;
  797.         $currentYear = (int) date('Y');
  798.         $projectReportStatus $this->isProgressReportActive;
  799.         if ($progressReports->isEmpty()) {
  800.             return 'not_available';
  801.         }
  802.         foreach ($progressReports as $progressReport) {
  803.             $progressReportYear = (int) ($progressReport->getCreatedAt())->format('Y');
  804.             if ($currentYear === $progressReportYear && $progressReport->getStatus() != 'completed' && $projectReportStatus == false) {
  805.                 return 'not_available';
  806.             }
  807.             if ($currentYear === $progressReportYear && $progressReport->getStatus() != 'completed' && $progressReport->isIsDraft() ) {
  808.                 return 'in_progress';
  809.             }
  810.             if ($currentYear === $progressReportYear && $progressReport->getStatus() == 'completed') {
  811.                 return 'complete';
  812.             }
  813.             if ($currentYear === $progressReportYear && $progressReport->getStatus() == 'created') {
  814.                 return 'created';
  815.             }
  816.             if ($currentYear === $progressReportYear && $progressReport->getStatus() == 'received') {
  817.                 return 'received';
  818.             }
  819.         }
  820.         return 'not_complete';
  821.     }
  822.     public function getLastYearProgressReportStatusUpdate(): string
  823.     {
  824.         $progressReports $this->filmProjectProgressReports;
  825.         $lastYear = (int) date('Y') - 1;
  826.         if ($progressReports->isEmpty()) {
  827.             return 'not_available';
  828.         }
  829.         foreach ($progressReports as $progressReport) {
  830.             $progressReportYear = (int) ($progressReport->getCreatedAt())->format('Y');
  831.             if ($lastYear === $progressReportYear && $progressReport->getStatus() != 'completed') {
  832.                 return 'not_complete';
  833.             }
  834.             if ($lastYear === $progressReportYear && $progressReport->getStatus() == 'completed') {
  835.                 return 'complete';
  836.             }
  837.         }
  838.         return 'not_available';
  839.     }
  840.     public function getRecurringProduct(): ?Product
  841.     {
  842.         return $this->recurringProduct;
  843.     }
  844.     public function setRecurringProduct(?Product $recurringProduct): static
  845.     {
  846.         $this->recurringProduct $recurringProduct;
  847.         return $this;
  848.     }
  849.     public function getProgressReportUrl(): ?string
  850.     {
  851.         $currentYear = (int) date('Y');
  852.         $progressReportUrl '/progress-report/'$currentYear .'?projectId=' $this->id;
  853.         $html '<div class="d-flex align-items-center "><a href="'$progressReportUrl .'" target="_blank" class="btn btn-primary">View Progress Report</a></div>';
  854.         return $html;
  855.     }
  856.     public function isIsProgressReportActive(): ?bool
  857.     {
  858.         return $this->isProgressReportActive;
  859.     }
  860.     public function setIsProgressReportActive(?bool $isProgressReportActive): static
  861.     {
  862.         $this->isProgressReportActive $isProgressReportActive;
  863.         return $this;
  864.     }
  865.     public function getProgressReportStartDate(): ?\DateTimeInterface
  866.     {
  867.         return $this->progressReportStartDate;
  868.     }
  869.     public function setProgressReportStartDate(?\DateTimeInterface $progressReportStartDate): static
  870.     {
  871.         $this->progressReportStartDate $progressReportStartDate;
  872.         return $this;
  873.     }
  874.     public function getCurrentProgressReportYear(): ?int
  875.     {
  876.         return $this->currentProgressReportYear;
  877.     }
  878.     public function setCurrentProgressReportYear(?int $currentProgressReportYear): static
  879.     {
  880.         $this->currentProgressReportYear $currentProgressReportYear;
  881.         return $this;
  882.     }
  883.     public function getProjectApprovalDate(): ?\DateTime
  884.     {
  885.         return $this->projectApprovalDate;
  886.     }
  887.     public function setProjectApprovalDate(?\DateTime $projectApprovalDate): static
  888.     {
  889.         $this->projectApprovalDate $projectApprovalDate;
  890.         return $this;
  891.     }
  892. }