Skip to content

Commit 0ef8a7a

Browse files
committed
Merge conflicts
2 parents 8b4cc81 + 0f3922c commit 0ef8a7a

File tree

11 files changed

+134
-68
lines changed

11 files changed

+134
-68
lines changed

app/code/Magento/SalesGraphQl/Model/InvoiceItemInterfaceTypeResolverComposite.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Framework\GraphQl\Query\Resolver\TypeResolverInterface;
1212

1313
/**
14-
* @inheritdoc
14+
* @inheritDoc
1515
*/
1616
class InvoiceItemInterfaceTypeResolverComposite implements TypeResolverInterface
1717
{
@@ -29,10 +29,10 @@ public function __construct(array $productTypeNameResolvers = [])
2929
}
3030

3131
/**
32-
* {@inheritdoc}
32+
* @inheritdoc
3333
* @throws GraphQlInputException
3434
*/
35-
public function resolveType(array $data) : string
35+
public function resolveType(array $data): string
3636
{
3737
$resolvedType = null;
3838

app/code/Magento/SalesGraphQl/Model/Resolver/CustomerOrders.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class CustomerOrders implements ResolverInterface
3030
private $searchQuery;
3131

3232
/**
33-
* @param SearchQuery $orderRepository
33+
* @param SearchQuery $searchQuery
3434
*/
3535
public function __construct(
3636
SearchQuery $searchQuery

app/code/Magento/SalesGraphQl/Model/Resolver/CustomerOrders/Query/OrderFilter.php

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public function __construct(
7474
* @param array $args
7575
* @param StoreInterface $store
7676
* @param SearchCriteriaBuilder $searchCriteriaBuilder
77-
* @throws InputException
7877
*/
7978
public function applyFilter(
8079
int $userId,
@@ -104,7 +103,11 @@ public function applyFilter(
104103
if (is_array($value)) {
105104
throw new InputException(__('Invalid match filter'));
106105
}
107-
$filters[] = $this->addMatchFilter($field, $value, $store);
106+
$searchValue = str_replace('%', '', $value);
107+
$filters[] = $this->filterBuilder->setField($field)
108+
->setValue("%{$searchValue}%")
109+
->setConditionType('like')
110+
->create();
108111
} else {
109112
$filters[] = $this->filterBuilder->setField($field)
110113
->setValue($value)
@@ -116,39 +119,7 @@ public function applyFilter(
116119

117120
$this->filterGroupBuilder->setFilters($filters);
118121
$filterGroups[] = $this->filterGroupBuilder->create();
119-
120122
}
121123
$searchCriteriaBuilder->setFilterGroups($filterGroups);
122124
}
123-
124-
/**
125-
* Add match filter to collection
126-
*
127-
* @param Collection $orderCollection
128-
* @param string $field
129-
* @param string $value
130-
* @param StoreInterface $store
131-
* @throws InputException
132-
*/
133-
private function addMatchFilter(
134-
string $field,
135-
string $value,
136-
StoreInterface $store
137-
): Filter {
138-
$minQueryLength = $this->scopeConfig->getValue(
139-
'catalog/search/min_query_length',
140-
ScopeInterface::SCOPE_STORE,
141-
$store
142-
) ?? self::DEFAULT_MIN_QUERY_LENGTH;
143-
$searchValue = str_replace('%', '', $value);
144-
$matchLength = strlen($searchValue);
145-
if ($matchLength < $minQueryLength) {
146-
throw new InputException(__('Invalid match filter. Minimum length is %1.', $minQueryLength));
147-
}
148-
149-
return $this->filterBuilder->setField($field)
150-
->setValue("%{$searchValue}%")
151-
->setConditionType('like')
152-
->create();
153-
}
154125
}

app/code/Magento/SalesGraphQl/Model/Resolver/CustomerOrders/Query/SearchQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function __construct(
6262
* Filter order data based off given search criteria
6363
*
6464
* @param array $args
65-
* @param int $userId,
65+
* @param int $userId
6666
* @param StoreInterface $store
6767
* @return DataObject
6868
* @throws InputException

app/code/Magento/SalesGraphQl/Model/Resolver/OrderItem/OptionsProcessor.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ public function getItemOptions(OrderItemInterface $orderItem): array
3030
$optionsTypes = $this->processOptions($options['options']);
3131
} elseif (isset($options['attributes_info'])) {
3232
$optionsTypes = $this->processAttributesInfo($options['attributes_info']);
33-
} elseif (isset($options['additional_options'])) {
34-
// TODO $options['additional_options']
3533
}
3634
}
3735
return $optionsTypes;

app/code/Magento/SalesGraphQl/Model/Resolver/Orders.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function resolve(
5555
/** @var Order $order */
5656
foreach ($orders as $order) {
5757
$items[] = [
58-
'id' => $order->getId(),
58+
'id' => base64_encode($order->getId()),
5959
'increment_id' => $order->getIncrementId(),
6060
'order_number' => $order->getIncrementId(),
6161
'created_at' => $order->getCreatedAt(),

app/code/Magento/SalesGraphQl/composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"php": "~7.3.0||~7.4.0",
77
"magento/framework": "*",
88
"magento/module-sales": "*",
9+
"magento/module-store": "*",
10+
"magento/module-catalog": "*",
911
"magento/module-shipping": "*",
1012
"magento/module-graph-ql": "*"
1113
},

dev/tests/api-functional/testsuite/Magento/GraphQl/Sales/InvoiceTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Magento\TestFramework\TestCase\GraphQlAbstract;
1313

1414
/**
15-
* Class Invoice Test
15+
* Tests the Invoice query
1616
*/
1717
class InvoiceTest extends GraphQlAbstract
1818
{
@@ -29,6 +29,7 @@ protected function setUp(): void
2929

3030
/**
3131
* @magentoApiDataFixture Magento/Sales/_files/customer_invoice_with_two_products_and_custom_options.php
32+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
3233
*/
3334
public function testSingleInvoiceForLoggedInCustomerQuery()
3435
{
@@ -150,6 +151,7 @@ public function testSingleInvoiceForLoggedInCustomerQuery()
150151

151152
/**
152153
* @magentoApiDataFixture Magento/Sales/_files/customer_multiple_invoices_with_two_products_and_custom_options.php
154+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
153155
*/
154156
public function testMultipleInvoiceForLoggedInCustomerQuery()
155157
{
@@ -291,6 +293,7 @@ public function testMultipleInvoiceForLoggedInCustomerQuery()
291293

292294
/**
293295
* @magentoApiDataFixture Magento/Sales/_files/customers_with_invoices.php
296+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
294297
*/
295298
public function testMultipleCustomersWithInvoicesQuery()
296299
{

0 commit comments

Comments
 (0)