protected function fetchByKeyPart(array $arr_key_parts, $str_setter)
{
// Build the query
$obj_request = (object) ['keys' => []];
$this->applyTransaction($obj_request);
// Add keys
foreach ($arr_key_parts as $str_key_part) {
$obj_element = (object) ['kind' => $this->obj_schema->getKind()];
if ('setId' === $str_setter) {
$obj_element->id = $str_key_part;
} elseif ('setName' === $str_setter) {
$obj_element->name = $str_key_part;
}
$obj_key = (object) ['path' => [$obj_element]];
$this->applyPartition($obj_key);
$obj_request->keys[] = $obj_key;
}
// Run
$this->executePostRequest('lookup', $obj_request);
// Extract results
$arr_mapped_results = [];
if (isset($this->obj_last_response->found) && is_array($this->obj_last_response->found)) {
$arr_mapped_results = $this->createMapper()->mapFromResults($this->obj_last_response->found);
}
$this->obj_schema = null;
// Consume Schema
return $arr_mapped_results;
}