From 51bf1b373ed3ed275c7b904aa3ad564411431f7a Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 16 Dec 2024 19:30:55 +0200 Subject: [PATCH] pkp/pkp-lib#10506 User Group refactoring to Eloquent Model (#61) --- OAIMetadataFormat_JATS.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OAIMetadataFormat_JATS.php b/OAIMetadataFormat_JATS.php index f582805..cdd66c0 100644 --- a/OAIMetadataFormat_JATS.php +++ b/OAIMetadataFormat_JATS.php @@ -23,6 +23,7 @@ use APP\issue\IssueAction; use PKP\plugins\PluginRegistry; use PKP\plugins\Hook; +use PKP\userGroup\UserGroup; class OAIMetadataFormat_JATS extends OAIMetadataFormat { /** @@ -442,7 +443,7 @@ protected function _mungeMetadata($doc, $journal, $article, $section, $issue) { } // Editorial team - $userGroups = Repo::userGroup()->getCollector()->filterByContextIds([$journal->getId()])->getMany(); + $userGroups = UserGroup::withContextIds([$journal->getId()])->get(); $journalMetaNode = $xpath->query('//article/front/journal-meta')->item(0); $contribGroupNode = $this->_addChildInOrder($journalMetaNode, $doc->createElement('contrib-group')); $keyContribTypeMapping = [ @@ -451,12 +452,12 @@ protected function _mungeMetadata($doc, $journal, $article, $section, $issue) { 'default.groups.name.sectionEditor' => 'secteditor', ]; foreach ($userGroups as $userGroup) { - if (!isset($keyContribTypeMapping[$userGroup->getData('nameLocaleKey')])) continue; + if (!isset($keyContribTypeMapping[$userGroup->nameLocaleKey])) continue; - $users = Repo::user()->getCollector()->filterByUserGroupIds([$userGroup->getId()])->getMany(); + $users = Repo::user()->getCollector()->filterByUserGroupIds([$userGroup->id])->getMany(); foreach ($users as $user) { $contribNode = $contribGroupNode->appendChild($doc->createElement('contrib')); - $contribNode->setAttribute('contrib-type', $keyContribTypeMapping[$userGroup->getData('nameLocaleKey')]); + $contribNode->setAttribute('contrib-type', $keyContribTypeMapping[$userGroup->nameLocaleKey]); $nameNode = $contribNode->appendChild($doc->createElement('name')); $surname = method_exists($user, 'getLastName')?$user->getLastName():$user->getLocalizedFamilyName(); if ($surname != '') {