Wallet.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. declare(strict_types = 1);
  3. namespace Plugin\WebMonetization\Entity;
  4. use App\Core\Entity;
  5. class Wallet extends Entity
  6. {
  7. // These tags are meant to be literally included and will be populated with the appropriate fields, setters and getters by `bin/generate_entity_fields`
  8. // {{{ Autocode
  9. // @codeCoverageIgnoreStart
  10. private int $id;
  11. private int $actor_id;
  12. private string $address;
  13. public function setId(int $id): self
  14. {
  15. $this->id = $id;
  16. return $this;
  17. }
  18. public function getId(): int
  19. {
  20. return $this->id;
  21. }
  22. public function setActorId(int $actor_id): self
  23. {
  24. $this->actor_id = $actor_id;
  25. return $this;
  26. }
  27. public function getActorId(): int
  28. {
  29. return $this->actor_id;
  30. }
  31. public function setAddress(string $address): self
  32. {
  33. $this->address = mb_substr($address, 0, 255);
  34. return $this;
  35. }
  36. public function getAddress(): string
  37. {
  38. return $this->address;
  39. }
  40. // @codeCoverageIgnoreEnd
  41. // }}} Autocode
  42. public static function schemaDef()
  43. {
  44. return [
  45. 'name' => 'webmonetizationWallet',
  46. 'fields' => [
  47. 'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'],
  48. 'actor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'foreign key to actor table'],
  49. 'address' => ['type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'wallet address'],
  50. ],
  51. 'primary key' => ['id'],
  52. ];
  53. }
  54. }