Reverse.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. namespace MGModule\DNSManager2\models\custom\reverse;
  3. use MGModule\DNSManager2 as main;
  4. use MGModule\DNSManager2\mgLibs\custom\dns\record\interfaces\ArrayPrinter;
  5. /**
  6. *
  7. *
  8. * @Table(name=reverse)
  9. */
  10. class Reverse extends main\mgLibs\models\orm implements ArrayPrinter {
  11. /**
  12. * ID field
  13. *
  14. * @Column(id)
  15. * @var int
  16. */
  17. public $id;
  18. /**
  19. *
  20. * @Column(int=11,uniqueKey=1)
  21. * @var int
  22. */
  23. public $serverid;
  24. /**
  25. *
  26. * @Column(int=11)
  27. * @var int
  28. */
  29. public $clientid;
  30. /**
  31. *
  32. * @Column(int=1)
  33. * @var int
  34. */
  35. public $type;
  36. /**
  37. *
  38. * @Column(int=11)
  39. * @var int
  40. */
  41. public $relid;
  42. /**
  43. *
  44. * @Column(varchar,isKey=1)
  45. * @var string
  46. */
  47. public $from;
  48. /**
  49. *
  50. * @Column(varchar,isKey=1)
  51. * @var string
  52. */
  53. public $sub;
  54. /**
  55. *
  56. * @Column(varchar)
  57. * @var string
  58. */
  59. public $name;
  60. /**
  61. *
  62. * @Column(varchar,uniqueKey=1,isKey=1)
  63. * @var string
  64. */
  65. public $ip;
  66. /**
  67. *
  68. * @Column(varchar)
  69. * @var string
  70. */
  71. public $ttl;
  72. /**
  73. *
  74. * @Column(datetime)
  75. * @var string
  76. */
  77. public $created_at;
  78. public static function byServerIDAndIP($serverid, $ip) {
  79. return Repository::factory()->byServerID($serverid)->byIP($ip)->one();
  80. }
  81. public function getServer() {
  82. return new main\models\custom\server\Server($this->serverid);
  83. }
  84. public function getFullDomain() {
  85. return ($this->sub?$this->sub . '.':'') . $this->from;
  86. }
  87. /** @return main\mgLibs\custom\dns\SubmoduleAbstract */
  88. public function getModule() {
  89. $module = $this->getServer()->getModule();
  90. $module->setDomain($this->from);
  91. return $module;
  92. }
  93. }