<?php
namespace App\Entity;
use App\Repository\DonationRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: DonationRepository::class)]
class Donation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\ManyToOne(targetEntity: FilmProject::class, inversedBy: 'donations')]
private $filmProject;
#[ORM\OneToOne(targetEntity: OrderDetails::class, cascade: ['persist', 'remove'])]
private $orderDetails;
#[ORM\Column(type: 'datetime', nullable: true)]
private $createdAt;
#[ORM\Column(type: 'datetime', nullable: true)]
private $modifiedAt;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isDonationEmail;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isOrganisationConsent;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isContactShared;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isNameApproved;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isRecurringDonation;
#[ORM\ManyToOne(targetEntity: RecurringDonation::class, inversedBy: 'donations', cascade: ['persist', 'remove'])]
private $recurringDonation;
#[ORM\Column(nullable: true)]
private ?float $supportdaf = null;
#[ORM\Column(nullable: true)]
private ?bool $isAmountInvisible = null;
private $isTermsCondition;
private $isNonFamily;
#[ORM\Column(length: 255, nullable: true)]
private ?string $supportDafSalesforce = null;
#[ORM\Column(nullable: true)]
private ?bool $isDisplayOrganisation = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $wordpressDonorName = null;
public function getId(): ?int
{
return $this->id;
}
public function getFilmProject(): ?FilmProject
{
return $this->filmProject;
}
public function setFilmProject(?FilmProject $filmProject): self
{
$this->filmProject = $filmProject;
return $this;
}
public function getOrderDetails(): ?OrderDetails
{
return $this->orderDetails;
}
public function setOrderDetails(?OrderDetails $orderDetails): self
{
$this->orderDetails = $orderDetails;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getModifiedAt(): ?\DateTimeInterface
{
return $this->modifiedAt;
}
public function setModifiedAt(?\DateTimeInterface $modifiedAt): self
{
$this->modifiedAt = $modifiedAt;
return $this;
}
public function isIsDonationEmail(): ?bool
{
return $this->isDonationEmail;
}
public function setIsDonationEmail(?bool $isDonationEmail): self
{
$this->isDonationEmail = $isDonationEmail;
return $this;
}
public function isIsOrganisationConsent(): ?bool
{
return $this->isOrganisationConsent;
}
public function setIsOrganisationConsent(?bool $isOrganisationConsent): self
{
$this->isOrganisationConsent = $isOrganisationConsent;
return $this;
}
public function isIsContactShared(): ?bool
{
return $this->isContactShared;
}
public function setIsContactShared(?bool $isContactShared): self
{
$this->isContactShared = $isContactShared;
return $this;
}
public function isIsNameApproved(): ?bool
{
return $this->isNameApproved;
}
public function setIsNameApproved(?bool $isNameApproved): self
{
$this->isNameApproved = $isNameApproved;
return $this;
}
public function isIsRecurringDonation(): ?bool
{
return $this->isRecurringDonation;
}
public function setIsRecurringDonation(?bool $isRecurringDonation): self
{
$this->isRecurringDonation = $isRecurringDonation;
return $this;
}
public function getRecurringDonation(): ?RecurringDonation
{
return $this->recurringDonation;
}
public function setRecurringDonation(?RecurringDonation $recurringDonation): self
{
$this->recurringDonation = $recurringDonation;
return $this;
}
public function getSupportdaf(): ?float
{
return $this->supportdaf;
}
public function setSupportdaf(?float $supportdaf): self
{
$this->supportdaf = $supportdaf;
return $this;
}
public function setAsNonAnonymous(): ?self
{
$this->isOrganisationConsent = true;
return $this;
}
public function setAsAnonymous(): ?self
{
$this->isOrganisationConsent = false;
return $this;
}
public function isIsAmountInvisible(): ?bool
{
return $this->isAmountInvisible;
}
public function setIsAmountInvisible(?bool $isAmountInvisible): self
{
$this->isAmountInvisible = $isAmountInvisible;
return $this;
}
public function getIsTermsCondition()
{
return false;
}
public function getIsNonFamily()
{
return false;
}
public function getSupportDafSalesforce(): ?string
{
return $this->supportDafSalesforce;
}
public function setSupportDafSalesforce(?string $supportDafSalesforce): self
{
$this->supportDafSalesforce = $supportDafSalesforce;
return $this;
}
public function getPopupAmount(): ?float
{
$finalAmount = 0;
if ($this->orderDetails) {
$total = (float)$this->orderDetails->getTotal();
if ($this->supportdaf) {
$finalAmount = $total - ((float)$this->supportdaf);
}
}
if ($finalAmount > 0 ) {
return $this->supportdaf;
}
return null;
}
public function isIsDisplayOrganisation(): ?bool
{
return $this->isDisplayOrganisation;
}
public function setIsDisplayOrganisation(?bool $isDisplayOrganisation): self
{
$this->isDisplayOrganisation = $isDisplayOrganisation;
return $this;
}
public function getWordpressDonorName(): ?string
{
return $this->wordpressDonorName;
}
public function setWordpressDonorName(?string $wordpressDonorName): static
{
$this->wordpressDonorName = $wordpressDonorName;
return $this;
}
}