*/ #[ORM\OneToMany(mappedBy: 'origin', targetEntity: WalletFinancement::class, cascade: ['persist'])] private Collection $financesTo; /** * A collection of Financements from incoming Statements that provided money for this Statement. * * Only not empty for outgoing Statements. * * @var Collection */ #[ORM\OneToMany(mappedBy: 'target', targetEntity: WalletFinancement::class, cascade: ['persist'])] private Collection $financedBy; public function __construct() { $this->financesTo = new ArrayCollection(); $this->financedBy = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getTransaction(): ?Transaction { return $this->transaction; } public function setTransaction(Transaction $transaction): static { $this->transaction = $transaction; return $this; } public function getDirection(): ?StatementDirection { return $this->direction; } public function hasDirection(StatementDirection $direction): bool { return $this->direction === $direction; } public function setDirection(StatementDirection $direction): static { $this->direction = $direction; return $this; } public function getBalance(): ?Money { return $this->balance; } public function setBalance(Money $balance): static { $this->balance = $balance; return $this; } /** * @return Collection */ public function getFinancesTo(): Collection { return $this->financesTo; } public function addFinancesTo(WalletFinancement $financesTo): static { if (!$this->financesTo->contains($financesTo)) { $this->financesTo->add($financesTo); $financesTo->setOrigin($this); } return $this; } public function removeFinancesTo(WalletFinancement $financesTo): static { if ($this->financesTo->removeElement($financesTo)) { // set the owning side to null (unless already changed) if ($financesTo->getOrigin() === $this) { $financesTo->setOrigin(null); } } return $this; } /** * @return Collection */ public function getFinancedBy(): Collection { return $this->financedBy; } public function addFinancedBy(WalletFinancement $financedBy): static { if (!$this->financedBy->contains($financedBy)) { $this->financedBy->add($financedBy); $financedBy->setTarget($this); } return $this; } public function removeFinancedBy(WalletFinancement $financedBy): static { if ($this->financedBy->removeElement($financedBy)) { // set the owning side to null (unless already changed) if ($financedBy->getTarget() === $this) { $financedBy->setTarget(null); } } return $this; } }