Skip to content

Commit

Permalink
pkp#10292 proper model import for native xml
Browse files Browse the repository at this point in the history
  • Loading branch information
touhidurabir committed Aug 20, 2024
1 parent 15f9263 commit 4845517
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
use PKP\filter\Filter;
use PKP\filter\FilterGroup;
use PKP\plugins\PluginRegistry;
use PKP\submission\SubmissionKeywordVocab;
use PKP\submission\SubmissionAgencyVocab;
use PKP\submission\SubmissionDisciplineVocab;
use PKP\submission\SubmissionSubjectVocab;

class NativeXmlPKPPublicationFilter extends NativeImportFilter
{
Expand Down Expand Up @@ -138,7 +142,7 @@ public function handleChildElement($n, $publication)
if (in_array($n->tagName, $setterMappings)) {
$publication->setData($n->tagName, $value, $locale);
} elseif (isset($controlledVocabulariesMappings[$n->tagName])) {
$controlledVocabulariesModel = $submissionKeywordModel = $controlledVocabulariesMappings[$n->tagName][0];
$controlledVocabulariesModel = $controlledVocabulariesMappings[$n->tagName][0];
$insertFunction = $controlledVocabulariesMappings[$n->tagName][1];

$controlledVocabulary = [];
Expand Down Expand Up @@ -315,10 +319,10 @@ public function _getLocalizedPublicationFields()
public function _getControlledVocabulariesMappings()
{
return [
'keywords' => ['SubmissionKeywordVocab', 'insertKeywords'],
'agencies' => ['SubmissionAgencyVocab', 'insertAgencies'],
'disciplines' => ['SubmissionDisciplineVocab', 'insertDisciplines'],
'subjects' => ['SubmissionSubjectVocab', 'insertSubjects'],
'keywords' => [SubmissionKeywordVocab::class, 'insertKeywords'],
'agencies' => [SubmissionAgencyVocab::class, 'insertAgencies'],
'disciplines' => [SubmissionDisciplineVocab::class, 'insertDisciplines'],
'subjects' => [SubmissionSubjectVocab::class, 'insertSubjects'],
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
use PKP\submission\PKPSubmission;
use PKP\submission\Representation;
use PKP\submission\RepresentationDAOInterface;
use PKP\submission\SubmissionKeywordVocab;
use PKP\submission\SubmissionAgencyVocab;
use PKP\submission\SubmissionDisciplineVocab;
use PKP\submission\SubmissionSubjectVocab;

class PKPPublicationNativeXmlFilter extends NativeExportFilter
{
Expand Down Expand Up @@ -304,10 +308,10 @@ public function addRepresentations($doc, $entityNode, $entity)
public function _getControlledVocabulariesMappings()
{
return [
'keywords' => ['SubmissionKeywordVocab', 'getKeywords', 'keyword'],
'agencies' => ['SubmissionAgencyVocab', 'getAgencies', 'agency'],
'disciplines' => ['SubmissionDisciplineVocab', 'getDisciplines', 'discipline'],
'subjects' => ['SubmissionSubjectVocab', 'getSubjects', 'subject'],
'keywords' => [SubmissionKeywordVocab::class, 'getKeywords', 'keyword'],
'agencies' => [SubmissionAgencyVocab::class, 'getAgencies', 'agency'],
'disciplines' => [SubmissionDisciplineVocab::class, 'getDisciplines', 'discipline'],
'subjects' => [SubmissionSubjectVocab::class, 'getSubjects', 'subject'],
];
}

Expand Down

0 comments on commit 4845517

Please sign in to comment.