GroupJoinQueue.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. declare(strict_types = 1);
  3. // {{{ License
  4. // This file is part of GNU social - https://www.gnu.org/software/social
  5. //
  6. // GNU social is free software: you can redistribute it and/or modify
  7. // it under the terms of the GNU Affero General Public License as published by
  8. // the Free Software Foundation, either version 3 of the License, or
  9. // (at your option) any later version.
  10. //
  11. // GNU social is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU Affero General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU Affero General Public License
  17. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
  18. // }}}
  19. namespace Component\Group\Entity;
  20. use App\Core\Entity;
  21. /**
  22. * Entity for Queue on joining a group
  23. *
  24. * @category DB
  25. * @package GNUsocial
  26. *
  27. * @author Zach Copley <zach@status.net>
  28. * @copyright 2010 StatusNet Inc.
  29. * @author Mikael Nordfeldth <mmn@hethane.se>
  30. * @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
  31. * @author Hugo Sales <hugo@hsal.es>
  32. * @copyright 2020-2021 Free Software Foundation, Inc http://www.fsf.org
  33. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  34. */
  35. class GroupJoinQueue extends Entity
  36. {
  37. // {{{ Autocode
  38. // @codeCoverageIgnoreStart
  39. private int $actor_id;
  40. private int $group_id;
  41. public function setActorId(int $actor_id): self
  42. {
  43. $this->actor_id = $actor_id;
  44. return $this;
  45. }
  46. public function getActorId(): int
  47. {
  48. return $this->actor_id;
  49. }
  50. public function setGroupId(int $group_id): self
  51. {
  52. $this->group_id = $group_id;
  53. return $this;
  54. }
  55. public function getGroupId(): int
  56. {
  57. return $this->group_id;
  58. }
  59. // @codeCoverageIgnoreEnd
  60. // }}} Autocode
  61. public static function schemaDef(): array
  62. {
  63. return [
  64. 'name' => 'group_join_queue',
  65. 'description' => 'Holder for group join requests awaiting moderation.',
  66. 'fields' => [
  67. 'actor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'many to one', 'name' => 'group_join_queue_actor_id_fkey', 'not null' => true, 'description' => 'remote or local actor making the request'],
  68. 'group_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Group.id', 'multiplicity' => 'many to one', 'name' => 'group_join_queue_group_id_fkey', 'not null' => true, 'description' => 'remote or local group to join, if any'],
  69. ],
  70. 'primary key' => ['actor_id', 'group_id'],
  71. 'indexes' => [
  72. 'group_join_queue_actor_id_idx' => ['actor_id'],
  73. 'group_join_queue_group_id_idx' => ['group_id'],
  74. ],
  75. ];
  76. }
  77. }