ForeignService.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. // {{{ License
  3. // This file is part of GNU social - https://www.gnu.org/software/social
  4. //
  5. // GNU social is free software: you can redistribute it and/or modify
  6. // it under the terms of the GNU Affero General Public License as published by
  7. // the Free Software Foundation, either version 3 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // GNU social is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU Affero General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU Affero General Public License
  16. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
  17. // }}}
  18. namespace Component\Bridge\Entity;
  19. use DateTimeInterface;
  20. /**
  21. * Entity for foreign services
  22. *
  23. * @category DB
  24. * @package GNUsocial
  25. *
  26. * @author Zach Copley <zach@status.net>
  27. * @copyright 2010 StatusNet Inc.
  28. * @author Mikael Nordfeldth <mmn@hethane.se>
  29. * @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
  30. * @author Hugo Sales <hugo@fc.up.pt>
  31. * @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
  32. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  33. */
  34. class ForeignService
  35. {
  36. // {{{ Autocode
  37. private int $id;
  38. private string $name;
  39. private ?string $description;
  40. private DateTimeInterface $created;
  41. private DateTimeInterface $modified;
  42. public function setId(int $id): self
  43. {
  44. $this->id = $id;
  45. return $this;
  46. }
  47. public function getId(): int
  48. {
  49. return $this->id;
  50. }
  51. public function setName(string $name): self
  52. {
  53. $this->name = $name;
  54. return $this;
  55. }
  56. public function getName(): string
  57. {
  58. return $this->name;
  59. }
  60. public function setDescription(?string $description): self
  61. {
  62. $this->description = $description;
  63. return $this;
  64. }
  65. public function getDescription(): ?string
  66. {
  67. return $this->description;
  68. }
  69. public function setCreated(DateTimeInterface $created): self
  70. {
  71. $this->created = $created;
  72. return $this;
  73. }
  74. public function getCreated(): DateTimeInterface
  75. {
  76. return $this->created;
  77. }
  78. public function setModified(DateTimeInterface $modified): self
  79. {
  80. $this->modified = $modified;
  81. return $this;
  82. }
  83. public function getModified(): DateTimeInterface
  84. {
  85. return $this->modified;
  86. }
  87. // }}} Autocode
  88. public static function schemaDef(): array
  89. {
  90. return [
  91. 'name' => 'foreign_service',
  92. 'fields' => [
  93. 'id' => ['type' => 'int', 'not null' => true, 'description' => 'numeric key for service'],
  94. 'name' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'name of the service'],
  95. 'description' => ['type' => 'varchar', 'length' => 191, 'description' => 'description'],
  96. 'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
  97. 'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
  98. ],
  99. 'primary key' => ['id'],
  100. 'unique keys' => [
  101. 'foreign_service_name_key' => ['name'],
  102. ],
  103. ];
  104. }
  105. }