[CORE][Entity][Note] Language can be null

This commit is contained in:
Diogo Peralta Cordeiro 2021-12-05 21:03:13 +00:00
parent 19b8a7648e
commit 63bf93d7f3
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
1 changed files with 4 additions and 7 deletions

View File

@ -85,9 +85,6 @@ class Note extends Entity
return $this->content_type;
}
/**
* @return Note
*/
public function setContentType(string $content_type): self
{
$this->content_type = $content_type;
@ -221,14 +218,14 @@ class Note extends Entity
return Cache::get("note-{$note_id}", fn () => DB::findOneBy('note', ['id' => $note_id]));
}
public function getNoteLanguageShortDisplay(): string
public function getNoteLanguageShortDisplay(): ?string
{
return Language::getById($this->language_id)->getShortDisplay();
return !is_null($this->language_id) ? Language::getById($this->language_id)->getShortDisplay() : null;
}
public function getLanguageLocale(): string
public function getLanguageLocale(): ?string
{
return Language::getById($this->language_id)->getLocale();
return !is_null($this->language_id) ? Language::getById($this->language_id)->getLocale() : null;
}
public static function getAllNotesByActor(Actor $actor): array