BundleCollection.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 Plugin\Bundles\Entity;
  20. use App\Core\Entity;
  21. /**
  22. * BlogCollection Entity
  23. *
  24. * @package GNUsocial
  25. * @category BlogCollectionsPlugin
  26. *
  27. * @author Eliseu Amaro <mail@eliseuama.ro>
  28. * @copyright 2022 Free Software Foundation, Inc http://www.fsf.org
  29. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  30. */
  31. class BundleCollection extends Entity
  32. {
  33. // {{{ Autocode
  34. // @codeCoverageIgnoreStart
  35. private int $id;
  36. private string $name;
  37. private int $actor_id;
  38. public function setId(int $id): self
  39. {
  40. $this->id = $id;
  41. return $this;
  42. }
  43. public function getId(): int
  44. {
  45. return $this->id;
  46. }
  47. public function setName(string $name): self
  48. {
  49. $this->name = mb_substr($name, 0, 255);
  50. return $this;
  51. }
  52. public function getName(): string
  53. {
  54. return $this->name;
  55. }
  56. public function setActorId(int $actor_id): self
  57. {
  58. $this->actor_id = $actor_id;
  59. return $this;
  60. }
  61. public function getActorId(): int
  62. {
  63. return $this->actor_id;
  64. }
  65. // @codeCoverageIgnoreEnd
  66. // }}} Autocode
  67. public static function schemaDef(): array
  68. {
  69. return [
  70. 'name' => 'blog_collection',
  71. 'fields' => [
  72. 'id' => ['type' => 'serial', 'not null' => true, 'description' => 'Unique Blog identifier'],
  73. 'name' => ['type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'A Blog Collection name, used to categorize Blog entries'],
  74. 'actor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'one to many', 'not null' => true, 'description' => 'Foreign key to actor table, the original author of this Collection'],
  75. ],
  76. 'primary key' => ['id'],
  77. 'foreign keys' => [
  78. 'actor_id_to_id_fkey' => ['actor', ['actor_id' => 'id']],
  79. ],
  80. ];
  81. }
  82. }