From dbd86b1b956398557b4a933d729cdd09c5dbc6e9 Mon Sep 17 00:00:00 2001 From: Daniel Berthereau Date: Mon, 2 Dec 2019 00:00:00 +0100 Subject: [PATCH] Renamed option "internal_id" by "o:id". --- src/Controller/IndexController.php | 2 +- src/Form/MappingForm.php | 2 +- src/Job/Import.php | 4 ++-- src/Mapping/AbstractResourceMapping.php | 4 ++-- .../Controller/Plugin/FindResourcesFromIdentifiers.php | 8 ++++---- view/csv-import/mapping-sidebar/item.phtml | 2 +- view/csv-import/mapping-sidebar/media.phtml | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Controller/IndexController.php b/src/Controller/IndexController.php index 92d3ee78..1c7edcd0 100644 --- a/src/Controller/IndexController.php +++ b/src/Controller/IndexController.php @@ -324,7 +324,7 @@ protected function cleanArgs(array $post) // Check the identifier property. if (array_key_exists('identifier_property', $args)) { $identifierProperty = $args['identifier_property']; - if (empty($identifierProperty) && $identifierProperty !== 'internal_id') { + if (empty($identifierProperty) && $identifierProperty !== 'o:id') { $properties = $api->search('properties', ['term' => $identifierProperty])->getContent(); if (empty($properties)) { $args['identifier_property'] = null; diff --git a/src/Form/MappingForm.php b/src/Form/MappingForm.php index 52fbc786..7afb368b 100644 --- a/src/Form/MappingForm.php +++ b/src/Form/MappingForm.php @@ -327,7 +327,7 @@ public function init() 'info' => 'Use this property, generally "dcterms:identifier", to identify the existing resources, so it will be possible to update them. One column of the file must map the selected property. In all cases, it is strongly recommended to add one ore more unique identifiers to all your resources.', // @translate 'empty_option' => 'Select below', // @translate 'prepend_value_options' => [ - 'internal_id' => 'Internal ID', // @translate + 'o:id' => 'Internal ID', // @translate ], 'term_as_value' => true, ], diff --git a/src/Job/Import.php b/src/Job/Import.php index a36cecbf..5e234c83 100644 --- a/src/Job/Import.php +++ b/src/Job/Import.php @@ -156,7 +156,7 @@ public function perform() // The main identifier property may be used as term or as id in some // places, so prepare it one time only. - if (empty($args['identifier_property']) || $args['identifier_property'] === 'internal_id') { + if (empty($args['identifier_property']) || $args['identifier_property'] === 'o:id') { $this->identifierPropertyId = $args['identifier_property']; } elseif (is_numeric($args['identifier_property'])) { $this->identifierPropertyId = (int) $args['identifier_property']; @@ -712,7 +712,7 @@ protected function filterDataWithoutIdentifier(array $data, array $identifiers) protected function idsForLog($ids, $hasIdentifierKeys = false) { switch ($this->args['identifier_property']) { - case 'internal_id': + case 'o:id': // Nothing to do. break; default: diff --git a/src/Mapping/AbstractResourceMapping.php b/src/Mapping/AbstractResourceMapping.php index dd3d1912..83162043 100644 --- a/src/Mapping/AbstractResourceMapping.php +++ b/src/Mapping/AbstractResourceMapping.php @@ -241,7 +241,7 @@ protected function processCellMedia($index, array $values) // Check params to avoid useless search and improve speed. $action = $this->args['action']; $identifier = reset($values); - $identifierProperty = $this->map['item'][$index] ?: 'internal_id'; + $identifierProperty = $this->map['item'][$index] ?: 'o:id'; $resourceType = 'items'; if (empty($identifier)) { @@ -268,7 +268,7 @@ protected function processCellMedia($index, array $values) } } - protected function findResource($identifier, $identifierProperty = 'internal_id') + protected function findResource($identifier, $identifierProperty = 'o:id') { $resourceType = $this->args['resource_type']; $findResourceFromIdentifier = $this->findResourceFromIdentifier; diff --git a/src/Mvc/Controller/Plugin/FindResourcesFromIdentifiers.php b/src/Mvc/Controller/Plugin/FindResourcesFromIdentifiers.php index 54a5c072..0bea351d 100644 --- a/src/Mvc/Controller/Plugin/FindResourcesFromIdentifiers.php +++ b/src/Mvc/Controller/Plugin/FindResourcesFromIdentifiers.php @@ -66,7 +66,7 @@ public function __construct(Connection $connection, ApiManager $apiManager) * @param array|string $identifiers Identifiers should be unique. If a * string is sent, the result will be the resource. * @param string|int|array $identifierName Property as integer or term, - * media ingester or "internal_id", or an array with multiple conditions. + * media ingester or "o:id", or an array with multiple conditions. * @param string $resourceType The resource type if any. * @return array|int|null Associative array with the identifiers as key and the ids * or null as value. Order is kept, but duplicate identifiers are removed. @@ -100,8 +100,8 @@ public function __invoke($identifiers, $identifierName, $resourceType = null) } } // Here, identifierName is a string or an integer. - elseif (in_array($identifierName, ['internal_id'])) { - $identifierType = 'internal_id'; + elseif (in_array($identifierName, ['o:id'])) { + $identifierType = 'o:id'; } elseif (is_numeric($identifierName)) { $identifierType = 'property'; $identifierName = (int) $identifierName; @@ -134,7 +134,7 @@ public function __invoke($identifiers, $identifierName, $resourceType = null) } switch ($identifierType) { - case 'internal_id': + case 'o:id': $result = $this->findResourcesFromInternalIds($identifiers, $resourceType); break; case 'property': diff --git a/view/csv-import/mapping-sidebar/item.phtml b/view/csv-import/mapping-sidebar/item.phtml index b43bf3ca..c258e091 100644 --- a/view/csv-import/mapping-sidebar/item.phtml +++ b/view/csv-import/mapping-sidebar/item.phtml @@ -11,7 +11,7 @@ 'empty_option' => $this->translate('Select below'), 'term_as_value' => false, 'prepend_value_options' => [ - 'internal_id' => $this->translate('Internal ID'), + 'o:id' => $this->translate('Internal ID'), ], 'term_as_value' => true, ], diff --git a/view/csv-import/mapping-sidebar/media.phtml b/view/csv-import/mapping-sidebar/media.phtml index e64dae00..1cbf2899 100644 --- a/view/csv-import/mapping-sidebar/media.phtml +++ b/view/csv-import/mapping-sidebar/media.phtml @@ -11,7 +11,7 @@ 'options' => [ 'empty_option' => $this->translate('Select below'), 'prepend_value_options' => [ - 'internal_id' => $this->translate('Internal ID'), + 'o:id' => $this->translate('Internal ID'), ], 'term_as_value' => true, ],