Skip to content

Commit

Permalink
refactor: changed logic for values fetching using new complex search …
Browse files Browse the repository at this point in the history
…tripple method for consistency..
  • Loading branch information
vbyndych committed Oct 12, 2023
1 parent 17de0e1 commit 1820fd2
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions core/kernel/persistence/starsql/class.Class.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,18 @@ public function getInstancesPropertyValues(
$propertyFilters = [],
$options = []
) {
$options['return_field'] = $property->getUri();

$search = $this->getModel()->getSearchInterface();
$query = $this->getFilterQuery($search->query(), $resource, $propertyFilters, $options);

return $search->getGateway()->search($query);
$resultSet = $search->getGateway()->searchTriples($query, $property->getUri(), $options['distinct'] ?? false);

$valueList = [];
/** @var core_kernel_classes_Triple $triple */
foreach($resultSet as $triple) {
$valueList[] = common_Utils::toResource($triple->object);
}

return $valueList;
}

/**
Expand Down Expand Up @@ -397,8 +403,6 @@ private function getFilterQuery(
$this->getClassFilter($options, $resource, $queryOptions),
[
'language' => $options['lang'] ?? '',
'distinct' => $options['distinct'] ?? false,
'return_field' => $options['return_field'] ?? null,
]
);

Expand Down

0 comments on commit 1820fd2

Please sign in to comment.