WorldBase.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. declare(strict_types=1);
  3. namespace ImiApp\Model\PgSql\Base;
  4. use Imi\Config\Annotation\ConfigValue;
  5. use Imi\Model\Annotation\Column;
  6. use Imi\Model\Annotation\Entity;
  7. use Imi\Model\Annotation\Table;
  8. use Imi\Pgsql\Model\PgModel as Model;
  9. /**
  10. * World 基类.
  11. *
  12. * @Entity(bean=false)
  13. * @Table(name=@ConfigValue(name="@app.models.ImiApp\Model\PgSql\World.name", default="World"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.ImiApp\Model\PgSql\World.poolName", default="pgsql"))
  14. *
  15. * @property int|null $id
  16. * @property int|null $randomnumber
  17. */
  18. abstract class WorldBase extends Model
  19. {
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public const PRIMARY_KEY = 'id';
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public const PRIMARY_KEYS = ["id"];
  28. /**
  29. * id.
  30. * @Column(name="id", type="int4", length=-1, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=1, isAutoIncrement=false, ndims=0, virtual=false)
  31. * @var int|null
  32. */
  33. protected ?int $id = NULL;
  34. /**
  35. * 获取 id.
  36. *
  37. * @return int|null
  38. */
  39. public function getId(): ?int
  40. {
  41. return $this->id;
  42. }
  43. /**
  44. * 赋值 id.
  45. *
  46. * @param int|null $id id
  47. * @return static
  48. */
  49. public function setId(?int $id)
  50. {
  51. $this->id = $id;
  52. return $this;
  53. }
  54. /**
  55. * randomnumber.
  56. * @Column(name="randomnumber", type="int4", length=-1, accuracy=0, nullable=false, default="0", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, ndims=0, virtual=false)
  57. * @var int|null
  58. */
  59. protected ?int $randomnumber = 0;
  60. /**
  61. * 获取 randomnumber.
  62. *
  63. * @return int|null
  64. */
  65. public function getRandomnumber(): ?int
  66. {
  67. return $this->randomnumber;
  68. }
  69. /**
  70. * 赋值 randomnumber.
  71. *
  72. * @param int|null $randomnumber randomnumber
  73. * @return static
  74. */
  75. public function setRandomnumber(?int $randomnumber)
  76. {
  77. $this->randomnumber = $randomnumber;
  78. return $this;
  79. }
  80. }