Skip to content

Commit 61c9ce8

Browse files
committed
fix issue graphql
1 parent 9250ce6 commit 61c9ce8

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

Model/Resolver/QuestionTagResolver.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,13 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
6161
{
6262
if (isset($value['question_id']) && $value['question_id']) {
6363
$collection = $this->tagCollection->create()->addFieldToFilter('question_id', $value['question_id']);
64+
$items = [];
65+
foreach($collection->getItems() as $_item) {
66+
$items[] = $_item->getData();
67+
}
6468
return [
6569
'total_count' => $collection->getSize(),
66-
'items' => $collection->getItems()
70+
'items' => $items
6771
];
6872
} else {
6973
return [];

Model/Resolver/Questions.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,14 @@ public function resolve(
9595
$searchResult = $this->questionRepository->getList($searchCriteria, $search, $tag, $identifier, $sku);
9696
$totalPages = $args['pageSize'] ? ((int)ceil($searchResult->getTotalCount() / $args['pageSize'])) : 0;
9797

98+
$items = [];
99+
foreach ($searchResult->getItems() as $_item) {
100+
$items[] = is_array($_item) ? $_item : $_item->toArray();
101+
}
102+
98103
return [
99104
'total_count' => $searchResult->getTotalCount(),
100-
'items' => $searchResult->getItems(),
105+
'items' => $items,
101106
'page_info' => [
102107
'page_size' => $args['pageSize'],
103108
'current_page' => $args['currentPage'],

Model/Resolver/Tags.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,13 @@ public function resolve(
6767
$collection->setCurPage($args['currentPage']);
6868
$collection->setPageSize($args['pageSize']);
6969

70+
$items = [];
71+
foreach ($collection as $_item) {
72+
$items[] = $_item->getdata();
73+
}
7074
return [
7175
'total_count' => $collection->getSize(),
72-
'items' => $collection->getData(),
76+
'items' => $items,
7377
'page_info' => [
7478
'page_size' => $collection->getPageSize(),
7579
'current_page' => $collection->getCurPage(),

0 commit comments

Comments
 (0)