Commit 465b7131 authored by Chivy Lim's avatar Chivy Lim

[TASK] Overwrite the default query property name used of argument setting

refs KIME-5209
parent c732c13c
......@@ -332,7 +332,12 @@ class SpreadsheetImportService {
$constraints[] = $query->equals($propertyName, $value);
}
$argumentIdentifierProperties = $this->getArgumentIdentifierProperties();
$contextArguments = $this->settings[$this->spreadsheetImport->getContext()]['arguments'];
foreach ($argumentIdentifierProperties as $property => $value) {
$key = array_search($property, array_column($contextArguments, 'name'));
if ($key !== FALSE && array_key_exists('queryPropertyName', $contextArguments[$key])) {
$property = $contextArguments[$key]['queryPropertyName'];
}
$constraints[] = $query->equals($property, $value);
}
if (!empty($constraints)) {
......@@ -351,7 +356,12 @@ class SpreadsheetImportService {
$query = $this->getDomainRepository()->createQuery();
$constraints[] = $query->logicalNot($query->in('Persistence_Object_Identifier', $identifiers));
// Include all the arguments into the query to get a subset only
$contextArguments = $this->settings[$this->spreadsheetImport->getContext()]['arguments'];
foreach ($this->spreadsheetImport->getArguments() as $name => $value) {
$key = array_search($name, array_column($contextArguments, 'name'));
if ($key !== FALSE && array_key_exists('queryPropertyName', $contextArguments[$key])) {
$name = $contextArguments[$key]['queryPropertyName'];
}
$constraints[] = $query->equals($name, $value);
}
return $query->matching($query->logicalAnd($constraints))->execute();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment