AttachmentCollectionEntry.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. declare(strict_types = 1);
  3. namespace Plugin\AttachmentCollections\Entity;
  4. use App\Core\Entity;
  5. class AttachmentCollectionEntry extends Entity
  6. {
  7. // These tags are meant to be literally included and will be populated with the appropriate fields, setters and getters by `bin/generate_entity_fields`
  8. // {{{ Autocode
  9. // @codeCoverageIgnoreStart
  10. private int $id;
  11. private int $note_id;
  12. private int $attachment_id;
  13. private int $collection_id;
  14. public function setId(int $id): self
  15. {
  16. $this->id = $id;
  17. return $this;
  18. }
  19. public function getId(): int
  20. {
  21. return $this->id;
  22. }
  23. public function setNoteId(int $note_id): self
  24. {
  25. $this->note_id = $note_id;
  26. return $this;
  27. }
  28. public function getNoteId(): int
  29. {
  30. return $this->note_id;
  31. }
  32. public function setAttachmentId(int $attachment_id): self
  33. {
  34. $this->attachment_id = $attachment_id;
  35. return $this;
  36. }
  37. public function getAttachmentId(): int
  38. {
  39. return $this->attachment_id;
  40. }
  41. public function setCollectionId(int $collection_id): self
  42. {
  43. $this->collection_id = $collection_id;
  44. return $this;
  45. }
  46. public function getCollectionId(): int
  47. {
  48. return $this->collection_id;
  49. }
  50. // @codeCoverageIgnoreEnd
  51. // }}} Autocode
  52. public static function schemaDef()
  53. {
  54. return [
  55. 'name' => 'attachment_collection_entry',
  56. 'fields' => [
  57. 'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'],
  58. 'note_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Note.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'foreign key to note table'],
  59. 'attachment_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Attachment.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'foreign key to attachment table'],
  60. 'collection_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Collection.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'foreign key to collection table'],
  61. ],
  62. 'primary key' => ['id'],
  63. ];
  64. }
  65. }