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