PinnedNotes.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. declare(strict_types = 1);
  3. namespace Plugin\PinnedNotes\Entity;
  4. use App\Core\Entity;
  5. class PinnedNotes extends Entity
  6. {
  7. private int $id;
  8. private int $actor_id;
  9. private int $note_id;
  10. public function getId()
  11. {
  12. return $this->id;
  13. }
  14. public function setId(int $id): self
  15. {
  16. $this->id = $id;
  17. return $this;
  18. }
  19. public function getActorId()
  20. {
  21. return $this->actor_id;
  22. }
  23. public function setActorId(int $actor_id): self
  24. {
  25. $this->actor_id = $actor_id;
  26. return $this;
  27. }
  28. public function getNoteId()
  29. {
  30. return $this->note_id;
  31. }
  32. public function setNoteId(int $note_id): self
  33. {
  34. $this->note_id = $note_id;
  35. return $this;
  36. }
  37. public static function schemaDef(): array
  38. {
  39. return [
  40. 'name' => 'pinned_notes',
  41. 'fields' => [
  42. 'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'],
  43. 'actor_id' => ['type' => 'int', 'not null' => true, 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'many to one', 'description' => 'Actor who pinned the note'],
  44. 'note_id' => ['type' => 'int', 'not null' => true, 'foreign key' => true, 'target' => 'Note.id', 'multiplicity' => 'many to one', 'description' => 'Pinned note'],
  45. ],
  46. 'primary key' => ['id'],
  47. ];
  48. }
  49. }