<?phpnamespace App\Entity;use App\Repository\TransactionRepository;use DateTimeImmutable;use DateTime;use DateTimeInterface;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=TransactionRepository::class) * @ORM\Table(name="app_payment_transaction") */class Transaction{ const STATUS_PENDING = 'pending'; const STATUS_ERROR = 'error'; const STATUS_ACCEPTED = 'accepted'; const STATUS_SUCCESS = 'success'; const STATUS_USER_FAILED= 'user_failed'; /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private int $id; /** * @ORM\ManyToOne(targetEntity=User::class) * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")) */ private ?User $user; /** * @ORM\Column(type="integer") */ private int $amount = 0; /** * @ORM\Column(type="string", length=30) */ private string $status = self::STATUS_PENDING; /** * @ORM\Column(type="integer", nullable=true) */ private ?int $code; /** * @ORM\Column(type="text", nullable=true) */ private ?string $response; /** * @ORM\Column(type="text", nullable=true) */ private ?string $request; /** * @ORM\Column(type="string", length=255, nullable=true) */ private ?string $internalIds; /** * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": "CURRENT_TIMESTAMP"}) */ private ?DateTimeInterface $createAt; public function __construct() { $this->createAt = new DateTimeImmutable(); } public function getId(): ?int { return $this->id; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): self { $this->user = $user; return $this; } public function getAmount(): ?int { return $this->amount; } public function setAmount(?int $amount): self { $this->amount = $amount; return $this; } public function getStatus(): ?string { return $this->status; } public function setStatus(?string $status): self { $this->status = $status; return $this; } public function getCode(): ?int { return $this->code; } public function setCode(?int $code): self { $this->code = $code; return $this; } public function getResponse(): ?string { return $this->response; } public function setResponse(?string $response): self { $this->response = $response; return $this; } public function getRequest(): ?string { return $this->request; } public function setRequest(?string $request): self { $this->request = $request; return $this; } public function getInternalIds(): ?string { return $this->internalIds; } public function setInternalIds(?string $internalIds): self { $this->internalIds = $internalIds; return $this; } public function addInternalId(string $internalId): self { $this->internalIds .= ';' . $internalId; return $this; } public function getCreateAt(): ?DateTimeInterface { return $this->createAt; } public function setCreateAt(?DateTimeImmutable $createAt): self { $this->createAt = $createAt; return $this; }}