From b89f57ce930844b31eb76f833dfbf72ed6ab5cf4 Mon Sep 17 00:00:00 2001 From: Diogo Peralta Cordeiro Date: Fri, 10 Dec 2021 03:59:23 +0000 Subject: [PATCH] [ENTITY][Note] Language can be null --- components/Posting/Posting.php | 4 ++-- src/Entity/Note.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/Posting/Posting.php b/components/Posting/Posting.php index 4719833d95..aa19fb644f 100644 --- a/components/Posting/Posting.php +++ b/components/Posting/Posting.php @@ -168,7 +168,7 @@ class Posting extends Component Actor $actor, string $content, string $content_type, - string $language, + ?string $language = null, array $attachments = [], array $processed_attachments = [], array $process_note_content_extra_args = [], @@ -181,7 +181,7 @@ class Posting extends Component 'content' => $content, 'content_type' => $content_type, 'rendered' => $rendered, - 'language_id' => Language::getByLocale($language)->getId(), + 'language_id' => !is_null($language) ? Language::getByLocale($language)->getId() : null, 'is_local' => true, ]); diff --git a/src/Entity/Note.php b/src/Entity/Note.php index f05ac1038f..7fa85d9efd 100644 --- a/src/Entity/Note.php +++ b/src/Entity/Note.php @@ -169,7 +169,7 @@ class Note extends Entity return $this; } - public function getLanguageId(): int + public function getLanguageId(): ?int { return $this->language_id; }