[PLUGIN][AttachmentCollections] Restore functionality

Some minor corrections
This commit is contained in:
2021-12-28 04:39:09 +00:00
parent a03429ba03
commit bb4149e092
9 changed files with 118 additions and 81 deletions

View File

@@ -6,12 +6,13 @@ namespace Plugin\AttachmentCollections\Entity;
use App\Core\Entity;
class CollectionEntry extends Entity
class AttachmentCollectionEntry extends Entity
{
// These tags are meant to be literally included and will be populated with the appropriate fields, setters and getters by `bin/generate_entity_fields`
// {{{ Autocode
// @codeCoverageIgnoreStart
private int $id;
private int $note_id;
private int $attachment_id;
private int $collection_id;
@@ -26,6 +27,17 @@ class CollectionEntry extends Entity
return $this->id;
}
public function setNoteId(int $note_id): self
{
$this->note_id = $note_id;
return $this;
}
public function getNoteId(): int
{
return $this->note_id;
}
public function setAttachmentId(int $attachment_id): self
{
$this->attachment_id = $attachment_id;
@@ -54,11 +66,12 @@ class CollectionEntry extends Entity
public static function schemaDef()
{
return [
'name' => 'attachment_album_entry',
'name' => 'attachment_collection_entry',
'fields' => [
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'],
'note_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Note.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'foreign key to note table'],
'attachment_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Attachment.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'foreign key to attachment table'],
'collection_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'AttachmentCollection.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'foreign key to attachment_collection table'],
'collection_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Collection.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'foreign key to collection table'],
],
'primary key' => ['id'],
];

View File

@@ -1,66 +0,0 @@
<?php
declare(strict_types = 1);
namespace Plugin\AttachmentCollections\Entity;
use App\Core\Entity;
class Collection extends Entity
{
// These tags are meant to be literally included and will be populated with the appropriate fields, setters and getters by `bin/generate_entity_fields`
// {{{ Autocode
// @codeCoverageIgnoreStart
private int $id;
private ?string $name = null;
private int $actor_id;
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function getId(): int
{
return $this->id;
}
public function setName(?string $name): self
{
$this->name = \is_null($name) ? null : mb_substr($name, 0, 255);
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setActorId(int $actor_id): self
{
$this->actor_id = $actor_id;
return $this;
}
public function getActorId(): int
{
return $this->actor_id;
}
// @codeCoverageIgnoreEnd
// }}} Autocode
public static function schemaDef()
{
return [
'name' => 'attachment_collection',
'fields' => [
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'],
'name' => ['type' => 'varchar', 'length' => 255, 'description' => 'collection\'s name'],
'actor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'one to many', 'not null' => true, 'description' => 'foreign key to actor table'],
],
'primary key' => ['id'],
];
}
}