[ENTITY][NoteTag] Add 'canonical' field to tag
This commit is contained in:
parent
04174bc56d
commit
556b8f8265
|
@ -20,6 +20,7 @@
|
|||
namespace App\Entity;
|
||||
|
||||
use App\Core\Entity;
|
||||
use Component\Tag\Tag;
|
||||
use DateTimeInterface;
|
||||
|
||||
/**
|
||||
|
@ -41,6 +42,7 @@ class NoteTag extends Entity
|
|||
// {{{ Autocode
|
||||
// @codeCoverageIgnoreStart
|
||||
private string $tag;
|
||||
private string $canonical;
|
||||
private int $note_id;
|
||||
private \DateTimeInterface $created;
|
||||
|
||||
|
@ -55,6 +57,17 @@ class NoteTag extends Entity
|
|||
return $this->tag;
|
||||
}
|
||||
|
||||
public function setCanonical(string $canonical): self
|
||||
{
|
||||
$this->canonical = $canonical;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCanonical(): string
|
||||
{
|
||||
return $this->canonical;
|
||||
}
|
||||
|
||||
public function setNoteId(int $note_id): self
|
||||
{
|
||||
$this->note_id = $note_id;
|
||||
|
@ -86,14 +99,16 @@ class NoteTag extends Entity
|
|||
'name' => 'note_tag',
|
||||
'description' => 'Hash tags on notes',
|
||||
'fields' => [
|
||||
'tag' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'hash tag associated with this note'],
|
||||
'note_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Note.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'foreign key to tagged note'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
'tag' => ['type' => 'varchar', 'length' => Tag::MAX_TAG_LENGTH, 'not null' => true, 'description' => 'hash tag associated with this note'],
|
||||
'canonical' => ['type' => 'varchar', 'length' => Tag::MAX_TAG_LENGTH, 'not null' => true, 'description' => 'ascii slug of hash tag'],
|
||||
'note_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Note.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'foreign key to tagged note'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['tag', 'note_id'],
|
||||
'indexes' => [
|
||||
'note_tag_created_idx' => ['created'],
|
||||
'note_tag_note_id_idx' => ['note_id'],
|
||||
'note_tag_canonical_idx' => ['canonical'],
|
||||
'note_tag_tag_created_note_id_idx' => ['tag', 'created', 'note_id'],
|
||||
],
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue
Block a user