<?php
declare(strict_types=1);
namespace App\Entity;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\OneToOne;
use DateTime;
#[Entity]
class PaymentBalance
{
#[Id]
#[OneToOne(targetEntity: User::class)]
#[JoinColumn(name: 'id', unique: true, nullable: false, onDelete: 'CASCADE')]
private User $user;
#[Column(type: 'float', nullable: false)]
private float $value;
#[Column(type: 'datetime')]
private DateTime $changedAt;
public function __construct()
{
$this->changedAt = new DateTime();
}
public function getUser(): User
{
return $this->user;
}
public function setUser(User $user): static
{
$this->user = $user;
return $this;
}
public function getValue(): float
{
return $this->value;
}
public function setValue(float $value): static
{
$this->value = $value;
return $this;
}
public function setChangedAt(DateTime $changedAt): static
{
$this->changedAt = $changedAt;
return $this;
}
public function getChangedAt(): DateTime
{
return $this->changedAt;
}
}