Skip to content

Commit 642daf9

Browse files
committed
Merge branch 'develop' of github.com:magento-pangolin/magento2ce into sprint-develop
2 parents 5bddb13 + 840d914 commit 642daf9

File tree

63 files changed

+3157
-614
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3157
-614
lines changed

.htaccess

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
############################################
3737
## adjust memory limit
3838

39-
php_value memory_limit 768M
39+
php_value memory_limit 756M
4040
php_value max_execution_time 18000
4141

4242
############################################
@@ -59,7 +59,7 @@
5959
############################################
6060
## adjust memory limit
6161

62-
php_value memory_limit 768M
62+
php_value memory_limit 756M
6363
php_value max_execution_time 18000
6464

6565
############################################

.htaccess.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
############################################
3636
## adjust memory limit
3737

38-
php_value memory_limit 768M
38+
php_value memory_limit 756M
3939
php_value max_execution_time 18000
4040

4141
############################################

.user.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
memory_limit = 768M
1+
memory_limit = 756M
22
max_execution_time = 18000
33
session.auto_start = off
44
suhosin.session.cryptua = off

app/code/Magento/Backend/Block/Dashboard/Graph.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ public function getChartUrl($directUrl = true)
421421
$tmpstring = implode('|', $this->_axisLabels[$idx]);
422422

423423
$valueBuffer[] = $indexid . ":|" . $tmpstring;
424+
} elseif ($idx == 'y') {
425+
$valueBuffer[] = $indexid . ":|" . implode('|', $yLabels);
424426
}
425427
$indexid++;
426428
}

app/code/Magento/Backend/Block/Media/Uploader.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Backend\Block\Media;
77

88
use Magento\Framework\App\ObjectManager;
9+
use Magento\Framework\Serialize\Serializer\Json;
910

1011
/**
1112
* Adminhtml media library uploader
@@ -30,25 +31,24 @@ class Uploader extends \Magento\Backend\Block\Widget
3031
protected $_fileSizeService;
3132

3233
/**
33-
* @var \Magento\Framework\Json\EncoderInterface
34+
* @var Json
3435
*/
35-
protected $_jsonEncoder;
36+
private $jsonEncoder;
3637

3738
/**
3839
* @param \Magento\Backend\Block\Template\Context $context
3940
* @param \Magento\Framework\File\Size $fileSize
4041
* @param array $data
41-
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
42+
* @param Json $jsonEncoder
4243
*/
4344
public function __construct(
4445
\Magento\Backend\Block\Template\Context $context,
4546
\Magento\Framework\File\Size $fileSize,
4647
array $data = [],
47-
\Magento\Framework\Json\EncoderInterface $jsonEncoder = null
48+
Json $jsonEncoder = null
4849
) {
49-
$this->_jsonEncoder = $jsonEncoder ?:
50-
ObjectManager::getInstance()->get(\Magento\Framework\Json\EncoderInterface::class);
5150
$this->_fileSizeService = $fileSize;
51+
$this->jsonEncoder = $jsonEncoder ?: ObjectManager::getInstance()->get(Json::class);
5252
parent::__construct($context, $data);
5353
}
5454

@@ -118,7 +118,7 @@ public function getJsObjectName()
118118
*/
119119
public function getConfigJson()
120120
{
121-
return $this->_jsonEncoder->encode($this->getConfig()->getData());
121+
return $this->jsonEncoder->encode($this->getConfig()->getData());
122122
}
123123

124124
/**

app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public function save(\Magento\Eav\Api\Data\AttributeSetInterface $attributeSet)
6262
*/
6363
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
6464
{
65+
$this->searchCriteriaBuilder->setFilterGroups((array)$searchCriteria->getFilterGroups());
6566
$this->searchCriteriaBuilder->addFilters(
6667
[
6768
$this->filterBuilder
@@ -71,9 +72,15 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
7172
->create(),
7273
]
7374
);
75+
76+
$this->searchCriteriaBuilder->setSortOrders((array)$searchCriteria->getSortOrders());
7477
$this->searchCriteriaBuilder->setCurrentPage($searchCriteria->getCurrentPage());
7578
$this->searchCriteriaBuilder->setPageSize($searchCriteria->getPageSize());
76-
return $this->attributeSetRepository->getList($this->searchCriteriaBuilder->create());
79+
80+
$searchResult = $this->attributeSetRepository->getList($this->searchCriteriaBuilder->create());
81+
$searchResult->setSearchCriteria($searchCriteria);
82+
83+
return $searchResult;
7784
}
7885

7986
/**
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\GraphQl\Controller;
8+
9+
use GraphQL\Error\FormattedError;
10+
use Magento\Framework\App\FrontControllerInterface;
11+
use Magento\Framework\App\RequestInterface;
12+
use Magento\Framework\App\ResponseInterface;
13+
use Magento\Framework\Webapi\Response;
14+
use Magento\GraphQl\Model\SchemaGeneratorInterface;
15+
16+
/**
17+
* Front controller for web API GraphQL area.
18+
*/
19+
class GraphQl implements FrontControllerInterface
20+
{
21+
/**
22+
* @var Response
23+
*/
24+
private $response;
25+
26+
/**
27+
* @var SchemaGeneratorInterface
28+
*/
29+
private $schemaGenerator;
30+
31+
/**
32+
* Initialize dependencies
33+
*
34+
* @param Response $response
35+
* @param SchemaGeneratorInterface $schemaGenerator
36+
*/
37+
public function __construct(
38+
Response $response,
39+
SchemaGeneratorInterface $schemaGenerator
40+
) {
41+
$this->response = $response;
42+
$this->schemaGenerator = $schemaGenerator;
43+
}
44+
45+
/**
46+
* Handle GraphQL request
47+
*
48+
* @param RequestInterface $request
49+
* @return ResponseInterface
50+
*/
51+
public function dispatch(RequestInterface $request)
52+
{
53+
try {
54+
if ($request->getHeader('Content-Type')
55+
&& strpos($request->getHeader('Content-Type'), 'application/json') !== false
56+
) {
57+
$raw = file_get_contents('php://input') ?: '';
58+
$data = json_decode($raw, true);
59+
} else {
60+
$data = $_REQUEST;
61+
}
62+
$schema = $this->schemaGenerator->generate();
63+
$result = \GraphQL\GraphQL::execute(
64+
$schema,
65+
isset($data['query']) ? $data['query'] : '',
66+
null,
67+
null,
68+
isset($data['variables']) ? $data['variables'] : []
69+
);
70+
} catch (\Exception $error) {
71+
$result['extensions']['exception'] = FormattedError::createFromException($error);
72+
$this->response->setStatusCode(500);
73+
}
74+
$this->response->setBody(json_encode($result))->setHeader('Content-Type', 'application/json');
75+
return $this->response;
76+
}
77+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\GraphQl\Model\Resolver;
8+
9+
use Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface;
10+
use Magento\Framework\Api\ExtensibleDataInterface;
11+
use Magento\Framework\Exception\NoSuchEntityException;
12+
use Magento\Framework\Webapi\ServiceOutputProcessor;
13+
14+
/**
15+
* Media gallery field resolver, used for GraphQL request processing.
16+
*/
17+
class MediaGalleryEntries
18+
{
19+
/**
20+
* @var ProductAttributeMediaGalleryManagementInterface
21+
*/
22+
private $mediaGalleryManagement;
23+
24+
/**
25+
* @var ServiceOutputProcessor
26+
*/
27+
private $serviceOutputProcessor;
28+
29+
/**
30+
* MediaGalleryEntries constructor.
31+
*
32+
* @param ProductAttributeMediaGalleryManagementInterface $mediaGalleryManagement
33+
* @param ServiceOutputProcessor $serviceOutputProcessor
34+
*/
35+
public function __construct(
36+
ProductAttributeMediaGalleryManagementInterface $mediaGalleryManagement,
37+
ServiceOutputProcessor $serviceOutputProcessor
38+
) {
39+
$this->mediaGalleryManagement = $mediaGalleryManagement;
40+
$this->serviceOutputProcessor = $serviceOutputProcessor;
41+
}
42+
43+
/**
44+
* Get media gallery entries for the specified product.
45+
*
46+
* @param string $sku
47+
* @return array|null
48+
*/
49+
public function getMediaGalleryEntries(string $sku)
50+
{
51+
try {
52+
$mediaGalleryObjectArray = $this->mediaGalleryManagement->getList($sku);
53+
} catch (NoSuchEntityException $e) {
54+
// No error should be thrown, null result should be returned
55+
return null;
56+
}
57+
58+
$mediaGalleryList = $this->serviceOutputProcessor->process(
59+
$mediaGalleryObjectArray,
60+
ProductAttributeMediaGalleryManagementInterface::class,
61+
'getList'
62+
);
63+
64+
foreach ($mediaGalleryList as $key => $mediaGallery) {
65+
if (isset($mediaGallery[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY])
66+
&& isset($mediaGallery[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]['video_content'])) {
67+
$mediaGallery = array_merge(
68+
$mediaGallery,
69+
$mediaGallery[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]
70+
);
71+
$mediaGalleryList[$key] = $mediaGallery;
72+
}
73+
}
74+
75+
return $mediaGalleryList;
76+
}
77+
}

0 commit comments

Comments
 (0)