src/Entity/Transaction.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TransactionRepository;
  4. use DateTimeImmutable;
  5. use DateTime;
  6. use DateTimeInterface;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=TransactionRepository::class)
  10.  * @ORM\Table(name="app_payment_transaction")
  11.  */
  12. class Transaction
  13. {
  14.     const STATUS_PENDING    'pending';
  15.     const STATUS_ERROR      'error';
  16.     const STATUS_ACCEPTED   'accepted';
  17.     const STATUS_SUCCESS    'success';
  18.     const STATUS_USER_FAILED'user_failed';
  19.     /**
  20.      * @ORM\Id()
  21.      * @ORM\GeneratedValue()
  22.      * @ORM\Column(type="integer")
  23.      */
  24.     private int $id;
  25.     /**
  26.      * @ORM\ManyToOne(targetEntity=User::class)
  27.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE"))
  28.      */
  29.     private ?User $user;
  30.     /**
  31.      * @ORM\Column(type="integer")
  32.      */
  33.     private int $amount 0;
  34.     /**
  35.      * @ORM\Column(type="string", length=30)
  36.      */
  37.     private string $status self::STATUS_PENDING;
  38.     /**
  39.      * @ORM\Column(type="integer", nullable=true)
  40.      */
  41.     private ?int $code;
  42.     /**
  43.      * @ORM\Column(type="text", nullable=true)
  44.      */
  45.     private ?string $response;
  46.     /**
  47.      * @ORM\Column(type="text", nullable=true)
  48.      */
  49.     private ?string $request;
  50.     /**
  51.      * @ORM\Column(type="string", length=255, nullable=true)
  52.      */
  53.     private ?string $internalIds;
  54.     /**
  55.      * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": "CURRENT_TIMESTAMP"})
  56.      */
  57.     private ?DateTimeInterface $createAt;
  58.     public function __construct()
  59.     {
  60.         $this->createAt = new DateTimeImmutable();
  61.     }
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function getUser(): ?User
  67.     {
  68.         return $this->user;
  69.     }
  70.     public function setUser(?User $user): self
  71.     {
  72.         $this->user $user;
  73.         return $this;
  74.     }
  75.     public function getAmount(): ?int
  76.     {
  77.         return $this->amount;
  78.     }
  79.     public function setAmount(?int $amount): self
  80.     {
  81.         $this->amount $amount;
  82.         return $this;
  83.     }
  84.     public function getStatus(): ?string
  85.     {
  86.         return $this->status;
  87.     }
  88.     public function setStatus(?string $status): self
  89.     {
  90.         $this->status $status;
  91.         return $this;
  92.     }
  93.     public function getCode(): ?int
  94.     {
  95.         return $this->code;
  96.     }
  97.     public function setCode(?int $code): self
  98.     {
  99.         $this->code $code;
  100.         return $this;
  101.     }
  102.     public function getResponse(): ?string
  103.     {
  104.         return $this->response;
  105.     }
  106.     public function setResponse(?string $response): self
  107.     {
  108.         $this->response $response;
  109.         return $this;
  110.     }
  111.     public function getRequest(): ?string
  112.     {
  113.         return $this->request;
  114.     }
  115.     public function setRequest(?string $request): self
  116.     {
  117.         $this->request $request;
  118.         return $this;
  119.     }
  120.     public function getInternalIds(): ?string
  121.     {
  122.         return $this->internalIds;
  123.     }
  124.     public function setInternalIds(?string $internalIds): self
  125.     {
  126.         $this->internalIds $internalIds;
  127.         return $this;
  128.     }
  129.     public function addInternalId(string $internalId): self
  130.     {
  131.         $this->internalIds .= ';' $internalId;
  132.         return $this;
  133.     }
  134.     public function getCreateAt(): ?DateTimeInterface
  135.     {
  136.         return $this->createAt;
  137.     }
  138.     public function setCreateAt(?DateTimeImmutable $createAt): self
  139.     {
  140.         $this->createAt $createAt;
  141.         return $this;
  142.     }
  143. }