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.     public function __construct()
  136.     {
  137.         $this->filmProjectMembers = new ArrayCollection();
  138.         $this->donations = new ArrayCollection();
  139.         $this->users = new ArrayCollection();
  140.         $this->filmProjectUpdates = new ArrayCollection();
  141.         $this->filmProjectImages = new ArrayCollection();
  142.         $this->filmProjectSponsors = new ArrayCollection();
  143.     }
  144.     public function getId(): ?int
  145.     {
  146.         return $this->id;
  147.     }
  148.     /**
  149.      * @return Collection<int, FilmProjectMember>
  150.      */
  151.     public function getFilmProjectMembers(): Collection
  152.     {
  153.         return $this->filmProjectMembers;
  154.     }
  155.     public function addFilmProjectMember(FilmProjectMember $filmProjectMember): self
  156.     {
  157.         if (!$this->filmProjectMembers->contains($filmProjectMember)) {
  158.             $this->filmProjectMembers[] = $filmProjectMember;
  159.             $filmProjectMember->setFilmProject($this);
  160.         }
  161.         return $this;
  162.     }
  163.     public function removeFilmProjectMember(FilmProjectMember $filmProjectMember): self
  164.     {
  165.         if ($this->filmProjectMembers->removeElement($filmProjectMember)) {
  166.             // set the owning side to null (unless already changed)
  167.             if ($filmProjectMember->getFilmProject() === $this) {
  168.                 $filmProjectMember->setFilmProject(null);
  169.             }
  170.         }
  171.         return $this;
  172.     }
  173.     public function getTitle(): ?string
  174.     {
  175.         return $this->title;
  176.     }
  177.     public function setTitle(?string $title): self
  178.     {
  179.         $this->title $title;
  180.         return $this;
  181.     }
  182.     public function getProductionStage(): ?string
  183.     {
  184.         return $this->productionStage;
  185.     }
  186.     public function setProductionStage(?string $productionStage): self
  187.     {
  188.         $this->productionStage $productionStage;
  189.         return $this;
  190.     }
  191.     public function getProductionStageWordpress(): ?string
  192.     {
  193.         if ($this->productionStage == 'Post-Production') {
  194.             return 'Post-production';
  195.         } elseif ($this->productionStage == 'Film Complete') {
  196.             return 'Film Completed';
  197.         }
  198.         return $this->productionStage;
  199.     }
  200.     public function getProductionType(): ?string
  201.     {
  202.         return $this->productionType;
  203.     }
  204.     public function setProductionType(?string $productionType): self
  205.     {
  206.         $this->productionType $productionType;
  207.         return $this;
  208.     }
  209.     public function getFilmProjectDetails(): ?FilmProjectDetails
  210.     {
  211.         return $this->filmProjectDetails;
  212.     }
  213.     public function setFilmProjectDetails(?FilmProjectDetails $filmProjectDetails): self
  214.     {
  215.         // unset the owning side of the relation if necessary
  216.         if ($filmProjectDetails === null && $this->filmProjectDetails !== null) {
  217.             $this->filmProjectDetails->setFilmProject(null);
  218.         }
  219.         // set the owning side of the relation if necessary
  220.         if ($filmProjectDetails !== null && $filmProjectDetails->getFilmProject() !== $this) {
  221.             $filmProjectDetails->setFilmProject($this);
  222.         }
  223.         $this->filmProjectDetails $filmProjectDetails;
  224.         return $this;
  225.     }
  226.     public function getFilmProjectStoryImpact(): ?FilmProjectStoryImpact
  227.     {
  228.         return $this->filmProjectStoryImpact;
  229.     }
  230.     public function setFilmProjectStoryImpact(?FilmProjectStoryImpact $filmProjectStoryImpact): self
  231.     {
  232.         // unset the owning side of the relation if necessary
  233.         if ($filmProjectStoryImpact === null && $this->filmProjectStoryImpact !== null) {
  234.             $this->filmProjectStoryImpact->setFilmProject(null);
  235.         }
  236.         // set the owning side of the relation if necessary
  237.         if ($filmProjectStoryImpact !== null && $filmProjectStoryImpact->getFilmProject() !== $this) {
  238.             $filmProjectStoryImpact->setFilmProject($this);
  239.         }
  240.         $this->filmProjectStoryImpact $filmProjectStoryImpact;
  241.         return $this;
  242.     }
  243.     public function getFilmProjectTimeline(): ?FilmProjectTimeline
  244.     {
  245.         return $this->filmProjectTimeline;
  246.     }
  247.     public function setFilmProjectTimeline(?FilmProjectTimeline $filmProjectTimeline): self
  248.     {
  249.         // unset the owning side of the relation if necessary
  250.         if ($filmProjectTimeline === null && $this->filmProjectTimeline !== null) {
  251.             $this->filmProjectTimeline->setFilmProject(null);
  252.         }
  253.         // set the owning side of the relation if necessary
  254.         if ($filmProjectTimeline !== null && $filmProjectTimeline->getFilmProject() !== $this) {
  255.             $filmProjectTimeline->setFilmProject($this);
  256.         }
  257.         $this->filmProjectTimeline $filmProjectTimeline;
  258.         return $this;
  259.     }
  260.     public function getFilmProjectFunding(): ?FilmProjectFunding
  261.     {
  262.         return $this->filmProjectFunding;
  263.     }
  264.     public function setFilmProjectFunding(?FilmProjectFunding $filmProjectFunding): self
  265.     {
  266.         // unset the owning side of the relation if necessary
  267.         if ($filmProjectFunding === null && $this->filmProjectFunding !== null) {
  268.             $this->filmProjectFunding->setFilmProject(null);
  269.         }
  270.         // set the owning side of the relation if necessary
  271.         if ($filmProjectFunding !== null && $filmProjectFunding->getFilmProject() !== $this) {
  272.             $filmProjectFunding->setFilmProject($this);
  273.         }
  274.         $this->filmProjectFunding $filmProjectFunding;
  275.         return $this;
  276.     }
  277.     public function getStatus(): ?string
  278.     {
  279.         return $this->status;
  280.     }
  281.     public function setStatus(string $status): self
  282.     {
  283.         $this->status $status;
  284.         return $this;
  285.     }
  286.     public function getOwner(): ?User
  287.     {
  288.         return $this->owner;
  289.     }
  290.     public function setOwner(?User $owner): self
  291.     {
  292.         $this->owner $owner;
  293.         return $this;
  294.     }
  295.     public function getOrder()
  296.     {
  297.         return 'not set';
  298.     }
  299.     public function getOrderDetails(): ?OrderDetails
  300.     {
  301.         return $this->orderDetails;
  302.     }
  303.     public function setOrderDetails(?OrderDetails $orderDetails): self
  304.     {
  305.         $this->orderDetails $orderDetails;
  306.         return $this;
  307.     }
  308.     public function getFilmProjectAdmin(): ?FilmProjectMember
  309.     {
  310.         return $this->filmProjectAdmin;
  311.     }
  312.     public function setFilmProjectAdmin(?FilmProjectMember $filmProjectAdmin): self
  313.     {
  314.         $this->filmProjectAdmin $filmProjectAdmin;
  315.         return $this;
  316.     }
  317.     public function getFilmProjectProducer(): ?FilmProjectMember
  318.     {
  319.         return $this->filmProjectProducer;
  320.     }
  321.     public function setFilmProjectProducer(?FilmProjectMember $filmProjectProducer): self
  322.     {
  323.         $this->filmProjectProducer $filmProjectProducer;
  324.         return $this;
  325.     }
  326.     public function getFilmProjectDirector(): ?FilmProjectMember
  327.     {
  328.         return $this->filmProjectDirector;
  329.     }
  330.     public function setFilmProjectDirector(?FilmProjectMember $filmProjectDirector): self
  331.     {
  332.         $this->filmProjectDirector $filmProjectDirector;
  333.         return $this;
  334.     }
  335.     public function getWordpressId(): ?int
  336.     {
  337.         return $this->wordpressId;
  338.     }
  339.     public function setWordpressId(?int $wordpressId): self
  340.     {
  341.         $this->wordpressId $wordpressId;
  342.         return $this;
  343.     }
  344.     public function getSalesforceId(): ?string
  345.     {
  346.         return $this->salesforceId;
  347.     }
  348.     public function setSalesforceId(?string $salesforceId): self
  349.     {
  350.         $this->salesforceId $salesforceId;
  351.         return $this;
  352.     }
  353.     public function getNote(): ?string
  354.     {
  355.         return $this->note;
  356.     }
  357.     public function setNote(?string $note): self
  358.     {
  359.         $this->note $note;
  360.         return $this;
  361.     }
  362.     public function getResubmitCount(): ?int
  363.     {
  364.         return $this->resubmitCount;
  365.     }
  366.     public function setResubmitCount(?int $resubmitCount): self
  367.     {
  368.         $this->resubmitCount $resubmitCount;
  369.         return $this;
  370.     }
  371.     public function getProduct(): ?Product
  372.     {
  373.         return $this->product;
  374.     }
  375.     public function setProduct(?Product $product): self
  376.     {
  377.         $this->product $product;
  378.         return $this;
  379.     }
  380.     public function getCreatedAt(): ?\DateTimeInterface
  381.     {
  382.         return $this->createdAt;
  383.     }
  384.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  385.     {
  386.         $this->createdAt $createdAt;
  387.         return $this;
  388.     }
  389.     public function getModifiedAt(): ?\DateTimeInterface
  390.     {
  391.         return $this->modifiedAt;
  392.     }
  393.     public function setModifiedAt(?\DateTimeInterface $modifiedAt): self
  394.     {
  395.         $this->modifiedAt $modifiedAt;
  396.         return $this;
  397.     }
  398.     /**
  399.      * @return Collection<int, Donation>
  400.      */
  401.     public function getDonations(): Collection
  402.     {
  403.         return $this->donations;
  404.     }
  405.     public function addDonation(Donation $donation): self
  406.     {
  407.         if (!$this->donations->contains($donation)) {
  408.             $this->donations[] = $donation;
  409.             $donation->setFilmProject($this);
  410.         }
  411.         return $this;
  412.     }
  413.     public function removeDonation(Donation $donation): self
  414.     {
  415.         if ($this->donations->removeElement($donation)) {
  416.             // set the owning side to null (unless already changed)
  417.             if ($donation->getFilmProject() === $this) {
  418.                 $donation->setFilmProject(null);
  419.             }
  420.         }
  421.         return $this;
  422.     }    
  423.     
  424.     public function getTotalDonation(): ?float
  425.     {
  426.         return $this->totalDonation;
  427.     }
  428.     public function setTotalDonation(?float $totalDonation): self
  429.     {
  430.         $this->totalDonation $totalDonation;
  431.         return $this;
  432.     }
  433.     // Add other functionalities below
  434.     public function addTotalDonation(float $amount): self
  435.     {
  436.         $this->totalDonation += $amount;
  437.         return $this;
  438.     }
  439.     public function reduceTotalDonation(float $amount): self
  440.     {
  441.         $this->totalDonation -= $amount;
  442.         return $this;
  443.     }
  444.     public function toString()
  445.     {
  446.         if ($this->title) {
  447.             return $this->title;
  448.         }
  449.         return '';
  450.     }
  451.     public function __toString()
  452.     {
  453.         return $this->toString();
  454.     }
  455.     public function getTrackingOptionId(): ?string
  456.     {
  457.         return $this->trackingOptionId;
  458.     }
  459.     public function setTrackingOptionId(?string $trackingOptionId): self
  460.     {
  461.         $this->trackingOptionId $trackingOptionId;
  462.         return $this;
  463.     }
  464.     public function getFilmProjectOriginal(): ?FilmProjectOriginal
  465.     {
  466.         return $this->filmProjectOriginal;
  467.     }
  468.     public function setFilmProjectOriginal(?FilmProjectOriginal $filmProjectOriginal): self
  469.     {
  470.         // unset the owning side of the relation if necessary
  471.         if ($filmProjectOriginal === null && $this->filmProjectOriginal !== null) {
  472.             $this->filmProjectOriginal->setFilmProject(null);
  473.         }
  474.         // set the owning side of the relation if necessary
  475.         if ($filmProjectOriginal !== null && $filmProjectOriginal->getFilmProject() !== $this) {
  476.             $filmProjectOriginal->setFilmProject($this);
  477.         }
  478.         $this->filmProjectOriginal $filmProjectOriginal;
  479.         return $this;
  480.     }
  481.     /**
  482.      * @return Collection<int, User>
  483.      */
  484.     public function getUsers(): Collection
  485.     {
  486.         return $this->users;
  487.     }
  488.     public function addUser(User $user): self
  489.     {
  490.         if (!$this->users->contains($user)) {
  491.             $this->users[] = $user;
  492.             $user->addFollowedFilmProject($this);
  493.         }
  494.         return $this;
  495.     }
  496.     public function removeUser(User $user): self
  497.     {
  498.         if ($this->users->removeElement($user)) {
  499.             $user->removeFollowedFilmProject($this);
  500.         }
  501.         return $this;
  502.     }
  503.     /**
  504.      * @return Collection<int, FilmProjectUpdate>
  505.      */
  506.     public function getFilmProjectUpdates(): Collection
  507.     {
  508.         return $this->filmProjectUpdates;
  509.     }
  510.     public function addFilmProjectUpdate(FilmProjectUpdate $filmProjectUpdate): self
  511.     {
  512.         if (!$this->filmProjectUpdates->contains($filmProjectUpdate)) {
  513.             $this->filmProjectUpdates->add($filmProjectUpdate);
  514.             $filmProjectUpdate->setFilmProject($this);
  515.         }
  516.         return $this;
  517.     }
  518.     public function removeFilmProjectUpdate(FilmProjectUpdate $filmProjectUpdate): self
  519.     {
  520.         if ($this->filmProjectUpdates->removeElement($filmProjectUpdate)) {
  521.             // set the owning side to null (unless already changed)
  522.             if ($filmProjectUpdate->getFilmProject() === $this) {
  523.                 $filmProjectUpdate->setFilmProject(null);
  524.             }
  525.         }
  526.         return $this;
  527.     }
  528.     public function getWordpressUrl(): string
  529.     {
  530.         $url '';
  531.         if ($this->wordpressId) {
  532.             $url Constant::WORDPRESS_URL '?page_id='$this->wordpressId;
  533.         }
  534.         return $url;
  535.     }
  536.     public function getWordpressDraftUrl(): string
  537.     {
  538.         $url '';
  539.         if ($this->wordpressId) {
  540.             $url Constant::WORDPRESS_URL '/admin-dashboard?redirect_to='urlencode("/?post_type=project&p="). $this->wordpressId;
  541.         }
  542.         return $url;
  543.     }
  544.     public function getFundingStatus(): string
  545.     {
  546.         $fundingStatus '-';
  547.         $currentFunding 0;
  548.         if ($this->totalDonation) {
  549.             $currentFunding '$'number_format($this->totalDonation 1002'.'',');
  550.         }
  551.         $totalDonation 0;
  552.         if($this->donations) {
  553.             $invoiceIdArr = [];
  554.             foreach ($this->donations as $donation) {
  555.                 $orderDetails $donation->getOrderDetails();
  556.                 $paymentDetails $orderDetails->getPaymentDetails();
  557.                 if (in_array($orderDetails->getInvoiceNumber(), $invoiceIdArr) || $paymentDetails->getStatus() != Constant::PAYMENT_STATUS_PAID) {
  558.                     continue;
  559.                 }
  560.                 $totalDonation += $orderDetails->getTotal();
  561.                 
  562.                 // Need to exclude popup amount if there is one
  563.                 $supportdaf $donation->getSupportDaf();
  564.                 if ($supportdaf) { 
  565.                     $totalDonation -= $supportdaf;
  566.                 }
  567.                 // Add invoice Number
  568.                 if ($orderDetails->getInvoiceNumber()) {
  569.                     array_push($invoiceIdArr$orderDetails->getInvoiceNumber());
  570.                 }
  571.             }
  572.             $currentFunding '$'number_format($totalDonation 1002'.'',');
  573.         }
  574.         if ($this->filmProjectFunding) {
  575.             if ($this->filmProjectFunding->getFundraisingGoal()) {
  576.                 $goal $this->filmProjectFunding->getFundraisingGoal() / 100;
  577.                 $goal '$'number_format($goal2'.'',');
  578.                 $fundingStatus $currentFunding .' / '$goal;
  579.             } else {
  580.                 return $fundingStatus;
  581.             }
  582.         }
  583.         return $fundingStatus;
  584.     }
  585.     public function getWordpressStatus(): ?string
  586.     {
  587.         return $this->wordpressStatus;
  588.     }
  589.     public function setWordpressStatus(?string $wordpressStatus): self
  590.     {
  591.         $this->wordpressStatus $wordpressStatus;
  592.         return $this;
  593.     }
  594.     public function teamMemberRole()
  595.     {
  596.         $role 'testing';
  597.         return $role;
  598.     }
  599.     /**
  600.      * @return Collection<int, FilmProjectImage>
  601.      */
  602.     public function getFilmProjectImages(): Collection
  603.     {
  604.         return $this->filmProjectImages;
  605.     }
  606.     public function addFilmProjectImage(FilmProjectImage $filmProjectImage): self
  607.     {
  608.         if (!$this->filmProjectImages->contains($filmProjectImage)) {
  609.             $this->filmProjectImages->add($filmProjectImage);
  610.             $filmProjectImage->setFilmProject($this);
  611.         }
  612.         return $this;
  613.     }
  614.     public function removeFilmProjectImage(FilmProjectImage $filmProjectImage): self
  615.     {
  616.         if ($this->filmProjectImages->removeElement($filmProjectImage)) {
  617.             // set the owning side to null (unless already changed)
  618.             if ($filmProjectImage->getFilmProject() === $this) {
  619.                 $filmProjectImage->setFilmProject(null);
  620.             }
  621.         }
  622.         return $this;
  623.     }
  624.     /**
  625.      * @return Collection<int, FilmProjectSponsor>
  626.      */
  627.     public function getFilmProjectSponsors(): Collection
  628.     {
  629.         return $this->filmProjectSponsors;
  630.     }
  631.     public function addFilmProjectSponsor(FilmProjectSponsor $filmProjectSponsor): self
  632.     {
  633.         if (!$this->filmProjectSponsors->contains($filmProjectSponsor)) {
  634.             $this->filmProjectSponsors->add($filmProjectSponsor);
  635.             $filmProjectSponsor->setFilmProject($this);
  636.         }
  637.         return $this;
  638.     }
  639.     public function removeFilmProjectSponsor(FilmProjectSponsor $filmProjectSponsor): self
  640.     {
  641.         if ($this->filmProjectSponsors->removeElement($filmProjectSponsor)) {
  642.             // set the owning side to null (unless already changed)
  643.             if ($filmProjectSponsor->getFilmProject() === $this) {
  644.                 $filmProjectSponsor->setFilmProject(null);
  645.             }
  646.         }
  647.         return $this;
  648.     }
  649.     /**
  650.      * Returning all project team members
  651.      *
  652.      * @return array
  653.      */
  654.     public function getAllMembers(): array
  655.     {
  656.         $filmProjectTeam = [];
  657.         $filmAdmin $this->getFilmProjectAdmin();
  658.         $filmProducer $this->getFilmProjectProducer();
  659.         $filmDirector $this->getFilmProjectDirector();
  660.         $filmProjectTeam = [$filmAdmin$filmProducer$filmDirector];
  661.         foreach($this->getFilmProjectMembers() as $filmProjectMember) {
  662.             array_push($filmProjectTeam$filmProjectMember);
  663.         }
  664.         return $filmProjectTeam;
  665.     }
  666.     public function getTabActive(): ?int
  667.     {
  668.         return $this->tabActive;
  669.     }
  670.     public function setTabActive(?int $tabActive): self
  671.     {
  672.         $this->tabActive $tabActive;
  673.         return $this;
  674.     }
  675.     public function isIsHideDonationBox(): ?bool
  676.     {
  677.         return $this->isHideDonationBox;
  678.     }
  679.     public function setIsHideDonationBox(?bool $isHideDonationBox): self
  680.     {
  681.         $this->isHideDonationBox $isHideDonationBox;
  682.         return $this;
  683.     }
  684.     
  685.     public function getWordpressPassword(): ?string
  686.     {
  687.         return $this->wordpressPassword;
  688.     }
  689.     public function setWordpressPassword(?string $wordpressPassword): self
  690.     {
  691.         $this->wordpressPassword $wordpressPassword;
  692.         return $this;
  693.     }
  694.     public function getOldWordpressId(): ?int
  695.     {
  696.         return $this->oldWordpressId;
  697.     }
  698.     public function setOldWordpressId(?int $oldWordpressId): self
  699.     {
  700.         $this->oldWordpressId $oldWordpressId;
  701.         return $this;
  702.     }
  703.     public function isIsDafCore(): ?bool
  704.     {
  705.         return $this->isDafCore;
  706.     }
  707.     public function setIsDafCore(?bool $isDafCore): self
  708.     {
  709.         $this->isDafCore $isDafCore;
  710.         return $this;
  711.     }
  712.     public function isIsDafProgram(): ?bool
  713.     {
  714.         return $this->isDafProgram;
  715.     }
  716.     public function setIsDafProgram(?bool $isDafProgram): self
  717.     {
  718.         $this->isDafProgram $isDafProgram;
  719.         return $this;
  720.     }
  721.     public function getXeroId(): ?string
  722.     {
  723.         return $this->xeroId;
  724.     }
  725.     public function setXeroId(?string $xeroId): static
  726.     {
  727.         $this->xeroId $xeroId;
  728.         return $this;
  729.     }
  730.      /**
  731.      * @return Collection<int, FilmProjectChangeHistory>
  732.      */
  733.     public function getFilmProjectChangeHistories(): Collection
  734.     {
  735.         return $this->filmProjectChangeHistories;
  736.     }
  737.     public function addFilmProjectChangeHistory(FilmProjectChangeHistory $filmProjectChangeHistory): static
  738.     {
  739.         if (!$this->filmProjectChangeHistories->contains($filmProjectChangeHistory)) {
  740.             $this->filmProjectChangeHistories->add($filmProjectChangeHistory);
  741.             $filmProjectChangeHistory->setFilmProject($this);
  742.         }
  743.         return $this;
  744.     }
  745.     public function removeFilmProjectChangeHistory(FilmProjectChangeHistory $filmProjectChangeHistory): static
  746.     {
  747.         if ($this->filmProjectChangeHistories->removeElement($filmProjectChangeHistory)) {
  748.             // set the owning side to null (unless already changed)
  749.             if ($filmProjectChangeHistory->getFilmProject() === $this) {
  750.                 $filmProjectChangeHistory->setFilmProject(null);
  751.             }
  752.         }
  753.         return $this;
  754.     }
  755.     /**
  756.      * @return Collection<int, FilmProjectProgressReport>
  757.      */
  758.     public function getFilmProjectProgressReports(): Collection
  759.     {
  760.         return $this->filmProjectProgressReports;
  761.     }
  762.     public function addFilmProjectProgressReport(FilmProjectProgressReport $filmProjectProgressReport): static
  763.     {
  764.         if (!$this->filmProjectProgressReports->contains($filmProjectProgressReport)) {
  765.             $this->filmProjectProgressReports->add($filmProjectProgressReport);
  766.             $filmProjectProgressReport->setFilmProject($this);
  767.         }
  768.         return $this;
  769.     }
  770.     public function removeFilmProjectProgressReport(FilmProjectProgressReport $filmProjectProgressReport): static
  771.     {
  772.         if ($this->filmProjectProgressReports->removeElement($filmProjectProgressReport)) {
  773.             // set the owning side to null (unless already changed)
  774.             if ($filmProjectProgressReport->getFilmProject() === $this) {
  775.                 $filmProjectProgressReport->setFilmProject(null);
  776.             }
  777.         }
  778.         return $this;
  779.     }
  780.     public function getProgressReportStatus() {
  781.         $progressReports $this->filmProjectProgressReports;
  782.         $currentYear = (int) date('Y');
  783.         foreach ($progressReports as $progressReport) {
  784.             $progressReportYear = (int) ($progressReport->getCreatedAt())->format('Y');
  785.             if ($currentYear === $progressReportYear && $progressReport->getStatus() == 'completed') {
  786.                 return true;
  787.             }
  788.         }
  789.         return false;
  790.     }
  791.     public function getProgressReportStatusUpdate() {
  792.         $progressReports $this->filmProjectProgressReports;
  793.         $currentYear = (int) date('Y');
  794.         if ($progressReports->isEmpty()) {
  795.             return 'not_available';
  796.         }
  797.         foreach ($progressReports as $progressReport) {
  798.             $progressReportYear = (int) ($progressReport->getCreatedAt())->format('Y');
  799.             if ($currentYear === $progressReportYear && $progressReport->getStatus() != 'completed' && $progressReport->isIsDraft() ) {
  800.                 return 'in_progress';
  801.             }
  802.             if ($currentYear === $progressReportYear && $progressReport->getStatus() == 'completed') {
  803.                 return 'complete';
  804.             }
  805.         }
  806.         return 'not_complete';
  807.     }
  808.     public function getRecurringProduct(): ?Product
  809.     {
  810.         return $this->recurringProduct;
  811.     }
  812.     public function setRecurringProduct(?Product $recurringProduct): static
  813.     {
  814.         $this->recurringProduct $recurringProduct;
  815.         return $this;
  816.     }
  817.     public function getProgressReportUrl(): ?string
  818.     {
  819.         $currentYear = (int) date('Y');
  820.         $progressReportUrl '/progress-report/'$currentYear .'?projectId=' $this->id;
  821.         $html '<div class="d-flex align-items-center "><a href="'$progressReportUrl .'" target="_blank" class="btn btn-primary">View Progress Report</a></div>';
  822.         return $html;
  823.     }
  824.     public function isIsProgressReportActive(): ?bool
  825.     {
  826.         return $this->isProgressReportActive;
  827.     }
  828.     public function setIsProgressReportActive(?bool $isProgressReportActive): static
  829.     {
  830.         $this->isProgressReportActive $isProgressReportActive;
  831.         return $this;
  832.     }
  833.     public function getProgressReportStartDate(): ?\DateTimeInterface
  834.     {
  835.         return $this->progressReportStartDate;
  836.     }
  837.     public function setProgressReportStartDate(?\DateTimeInterface $progressReportStartDate): static
  838.     {
  839.         $this->progressReportStartDate $progressReportStartDate;
  840.         return $this;
  841.     }
  842. }