diff --git a/classes/author/Author.php b/classes/author/Author.php index 8db937368c3..11b3399821d 100644 --- a/classes/author/Author.php +++ b/classes/author/Author.php @@ -17,6 +17,7 @@ */ namespace PKP\author; + use PKP\facades\Locale; use PKP\identity\Identity; use PKP\userGroup\UserGroup; @@ -25,10 +26,11 @@ class Author extends Identity { /** * Get the default/fall back locale the values should exist for + * (see LocalizedData trait) */ public function getDefaultLocale(): ?string { - return $this->getSubmissionLocale(); + return $this->getData('submissionLocale'); } /** @@ -79,26 +81,6 @@ public function setSubmissionId($submissionId) $this->setData('submissionId', $submissionId); } - /** - * Get submission locale. - * - * @return string - */ - public function getSubmissionLocale() - { - return $this->getData('locale'); - } - - /** - * Set submission locale. - * - * @param string $locale - */ - public function setSubmissionLocale($locale) - { - return $this->setData('locale', $locale); - } - /** * Set the user group id * diff --git a/classes/author/DAO.php b/classes/author/DAO.php index 6998fa3c6e1..9a6585c2f5e 100644 --- a/classes/author/DAO.php +++ b/classes/author/DAO.php @@ -155,7 +155,7 @@ public function fromRow(object $row): Author $author = parent::fromRow($row); // Set the primary locale from the submission - $author->setData('locale', $row->submission_locale); + $author->setData('submissionLocale', $row->submission_locale); return $author; } diff --git a/classes/submissionFile/Collector.php b/classes/submissionFile/Collector.php index 8b2aa95bd81..b6325b141cc 100644 --- a/classes/submissionFile/Collector.php +++ b/classes/submissionFile/Collector.php @@ -1,4 +1,5 @@ dao->table . ' as sf') ->join('submissions as s', 's.submission_id', '=', 'sf.submission_id') ->join('files as f', 'f.file_id', '=', 'sf.file_id') - ->select(['sf.*', 'f.*', 's.locale as locale']); + ->select(['sf.*', 'f.*', 's.locale as submission_locale']); if ($this->submissionIds !== null) { $qb->whereIn('sf.submission_id', $this->submissionIds); diff --git a/classes/submissionFile/DAO.php b/classes/submissionFile/DAO.php index 7cb16cd7cfb..d8360d6a997 100644 --- a/classes/submissionFile/DAO.php +++ b/classes/submissionFile/DAO.php @@ -163,7 +163,7 @@ public function getMany(Collector $query): LazyCollection public function fromRow(object $primaryRow): SubmissionFile { $submissionFile = parent::fromRow($primaryRow); - $submissionFile->setData('locale', $primaryRow->locale); + $submissionFile->setData('submissionLocale', $primaryRow->submission_locale); $submissionFile->setData('path', $primaryRow->path); $submissionFile->setData('mimetype', $primaryRow->mimetype); diff --git a/classes/submissionFile/SubmissionFile.php b/classes/submissionFile/SubmissionFile.php index 6c21d1e4db5..5939cdaf204 100644 --- a/classes/submissionFile/SubmissionFile.php +++ b/classes/submissionFile/SubmissionFile.php @@ -18,7 +18,6 @@ use APP\facades\Repo; use PKP\facades\Locale; -use PKP\i18n\LocaleMetadata; use PKP\services\PKPSchemaService; /** @@ -55,40 +54,11 @@ class SubmissionFile extends \PKP\core\DataObject /** * Get the default/fall back locale the values should exist for + * (see LocalizedData trait) */ public function getDefaultLocale(): ?string { - return $this->getData('locale'); - } - - /** - * Get the locale of the submission. - * This is not properly a property of the submission file - * (e.g. it won't be persisted to the DB with the update function) - * It helps solve submission locale requirement for file's multilingual metadata - * - * @deprecated 3.3.0.0 - * - * @return string - */ - public function getSubmissionLocale() - { - return $this->getData('locale'); - } - - /** - * Set the locale of the submission. - * This is not properly a property of the submission file - * (e.g. it won't be persisted to the DB with the update function) - * It helps solve submission locale requirement for file's multilingual metadata - * - * @deprecated 3.3.0.0 - * - * @param string $submissionLocale - */ - public function setSubmissionLocale($submissionLocale) - { - $this->setData('locale', $submissionLocale); + return $this->getData('submissionLocale'); } /** @@ -401,7 +371,7 @@ public function getLanguages(): array { $props = app()->get('schema')->getMultilingualProps(PKPSchemaService::SCHEMA_SUBMISSION_FILE); $locales = array_map(fn (string $prop): array => array_keys($this->getData($prop) ?? []), $props); - return collect([$this->getData('locale')]) + return collect([$this->getData('submissionLocale')]) ->concat($locales) ->flatten() ->filter()