upstream V3 development https://www.gnusocial.rocks/v3
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

119 lines
3.4 KiB

  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 Plugin\ProfileColor\Entity;
  19. use App\Core\Entity;
  20. use DateTimeInterface;
  21. /**
  22. * For storing a profile Color
  23. *
  24. * @package GNUsocial
  25. * @category CoverPlugin
  26. *
  27. * @author Daniel Brandao <up201705812@fe.up.pt>
  28. * @copyright 2020 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 ProfileColor extends Entity
  32. {
  33. // {{{ Autocode
  34. // @codeCoverageIgnoreStart
  35. private int $actor_id;
  36. private ?string $color;
  37. private ?string $background;
  38. private \DateTimeInterface $created;
  39. private \DateTimeInterface $modified;
  40. public function setActorId(int $actor_id): self
  41. {
  42. $this->actor_id = $actor_id;
  43. return $this;
  44. }
  45. public function getActorId(): int
  46. {
  47. return $this->actor_id;
  48. }
  49. public function setColor(string $color): self
  50. {
  51. $this->color = $color;
  52. return $this;
  53. }
  54. public function getColor(): ?string
  55. {
  56. return $this->color;
  57. }
  58. public function setBackground(string $background): self
  59. {
  60. $this->background = $background;
  61. return $this;
  62. }
  63. public function getBackground(): ?string
  64. {
  65. return $this->background;
  66. }
  67. public function setCreated(DateTimeInterface $created): self
  68. {
  69. $this->created = $created;
  70. return $this;
  71. }
  72. public function getCreated(): DateTimeInterface
  73. {
  74. return $this->created;
  75. }
  76. public function setModified(DateTimeInterface $modified): self
  77. {
  78. $this->modified = $modified;
  79. return $this;
  80. }
  81. public function getModified(): DateTimeInterface
  82. {
  83. return $this->modified;
  84. }
  85. // @codeCoverageIgnoreEnd
  86. // }}} Autocode
  87. public static function schemaDef(): array
  88. {
  89. return [
  90. 'name' => 'profile_color',
  91. 'fields' => [
  92. 'actor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'foreign key to actor table'],
  93. 'background' => ['type' => 'text', 'description' => 'color hex code'],
  94. 'color' => ['type' => 'text', 'description' => 'color hex code'],
  95. 'created' => ['type' => 'datetime', 'not null' => true, 'description' => 'date this record was created', 'default' => 'CURRENT_TIMESTAMP'],
  96. 'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified', 'default' => 'CURRENT_TIMESTAMP'],
  97. ],
  98. 'primary key' => ['actor_id'],
  99. ];
  100. }
  101. }