Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Controller/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Form/MappingForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
Expand Down
4 changes: 2 additions & 2 deletions src/Job/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/Mapping/AbstractResourceMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/Mvc/Controller/Plugin/FindResourcesFromIdentifiers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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':
Expand Down
2 changes: 1 addition & 1 deletion view/csv-import/mapping-sidebar/item.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
Expand Down
2 changes: 1 addition & 1 deletion view/csv-import/mapping-sidebar/media.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
Expand Down