Skip to content

Commit c3d76ed

Browse files
author
Natalia Momotenko
committed
Merge remote-tracking branch 'magento2ce/develop' into develop
2 parents 18d59e7 + 068d068 commit c3d76ed

File tree

1,194 files changed

+11676
-15078
lines changed

Some content is hidden

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

1,194 files changed

+11676
-15078
lines changed

app/code/Magento/Authorization/Model/Resource/Role.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,19 @@ class Role extends \Magento\Framework\Model\Resource\Db\AbstractDb
3232
protected $dateTime;
3333

3434
/**
35-
* @param \Magento\Framework\App\Resource $resource
35+
* @param \Magento\Framework\Model\Resource\Db\Context $context
3636
* @param \Magento\Framework\App\CacheInterface $cache
3737
* @param \Magento\Framework\Stdlib\DateTime $dateTime
38+
* @param string|null $resourcePrefix
3839
*/
3940
public function __construct(
40-
\Magento\Framework\App\Resource $resource,
41+
\Magento\Framework\Model\Resource\Db\Context $context,
4142
\Magento\Framework\App\CacheInterface $cache,
42-
\Magento\Framework\Stdlib\DateTime $dateTime
43+
\Magento\Framework\Stdlib\DateTime $dateTime,
44+
$resourcePrefix = null
4345
) {
4446
$this->dateTime = $dateTime;
45-
parent::__construct($resource);
47+
parent::__construct($context, $resourcePrefix);
4648
$this->_cache = $cache->getFrontend();
4749
}
4850

app/code/Magento/Authorization/Model/Resource/Rules.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,23 @@ class Rules extends \Magento\Framework\Model\Resource\Db\AbstractDb
3838
protected $_logger;
3939

4040
/**
41-
* @param \Magento\Framework\App\Resource $resource
41+
* @param \Magento\Framework\Model\Resource\Db\Context $context
4242
* @param \Magento\Framework\Acl\Builder $aclBuilder
4343
* @param \Psr\Log\LoggerInterface $logger
4444
* @param \Magento\Framework\Acl\RootResource $rootResource
4545
* @param \Magento\Framework\Acl\CacheInterface $aclCache
46+
* @param string|null $resourcePrefix
4647
*/
4748
public function __construct(
48-
\Magento\Framework\App\Resource $resource,
49+
\Magento\Framework\Model\Resource\Db\Context $context,
4950
\Magento\Framework\Acl\Builder $aclBuilder,
5051
\Psr\Log\LoggerInterface $logger,
5152
\Magento\Framework\Acl\RootResource $rootResource,
52-
\Magento\Framework\Acl\CacheInterface $aclCache
53+
\Magento\Framework\Acl\CacheInterface $aclCache,
54+
$resourcePrefix = null
5355
) {
5456
$this->_aclBuilder = $aclBuilder;
55-
parent::__construct($resource);
57+
parent::__construct($context, $resourcePrefix);
5658
$this->_rootResource = $rootResource;
5759
$this->_aclCache = $aclCache;
5860
$this->_logger = $logger;

app/code/Magento/Bundle/Api/ProductLinkManagementInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface ProductLinkManagementInterface
1414
* @param string $productId
1515
* @return \Magento\Bundle\Api\Data\LinkInterface[]
1616
* @throws \Magento\Framework\Exception\NoSuchEntityException
17-
* @throws \Magento\Webapi\Exception
17+
* @throws \Magento\Framework\Exception\InputException
1818
*/
1919
public function getChildren($productId);
2020

@@ -53,7 +53,7 @@ public function addChild(
5353
* @param int $optionId
5454
* @param string $childSku
5555
* @throws \Magento\Framework\Exception\NoSuchEntityException
56-
* @throws \Magento\Webapi\Exception
56+
* @throws \Magento\Framework\Exception\InputException
5757
* @return bool
5858
*/
5959
public function removeChild($productSku, $optionId, $childSku);

app/code/Magento/Bundle/Api/ProductOptionManagementInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface ProductOptionManagementInterface
1414
* @param \Magento\Bundle\Api\Data\OptionInterface $option
1515
* @return int
1616
* @throws \Magento\Framework\Exception\CouldNotSaveException
17-
* @throws \Magento\Webapi\Exception
17+
* @throws \Magento\Framework\Exception\InputException
1818
*/
1919
public function save(\Magento\Bundle\Api\Data\OptionInterface $option);
2020
}

app/code/Magento/Bundle/Api/ProductOptionRepositoryInterface.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface ProductOptionRepositoryInterface
1515
* @param int $optionId
1616
* @return \Magento\Bundle\Api\Data\OptionInterface
1717
* @throws \Magento\Framework\Exception\NoSuchEntityException
18-
* @throws \Magento\Webapi\Exception
18+
* @throws \Magento\Framework\Exception\InputException
1919
*/
2020
public function get($productSku, $optionId);
2121

@@ -25,7 +25,7 @@ public function get($productSku, $optionId);
2525
* @param string $productSku
2626
* @return \Magento\Bundle\Api\Data\OptionInterface[]
2727
* @throws \Magento\Framework\Exception\NoSuchEntityException
28-
* @throws \Magento\Webapi\Exception
28+
* @throws \Magento\Framework\Exception\InputException
2929
*/
3030
public function getList($productSku);
3131

@@ -35,7 +35,7 @@ public function getList($productSku);
3535
* @param \Magento\Bundle\Api\Data\OptionInterface $option
3636
* @return bool
3737
* @throws \Magento\Framework\Exception\CouldNotSaveException
38-
* @throws \Magento\Webapi\Exception
38+
* @throws \Magento\Framework\Exception\InputException
3939
*/
4040
public function delete(\Magento\Bundle\Api\Data\OptionInterface $option);
4141

@@ -46,7 +46,7 @@ public function delete(\Magento\Bundle\Api\Data\OptionInterface $option);
4646
* @param int $optionId
4747
* @return bool
4848
* @throws \Magento\Framework\Exception\CouldNotSaveException
49-
* @throws \Magento\Webapi\Exception
49+
* @throws \Magento\Framework\Exception\InputException
5050
*/
5151
public function deleteById($productSku, $optionId);
5252

@@ -57,7 +57,7 @@ public function deleteById($productSku, $optionId);
5757
* @param \Magento\Bundle\Api\Data\OptionInterface $option
5858
* @return int
5959
* @throws \Magento\Framework\Exception\CouldNotSaveException
60-
* @throws \Magento\Webapi\Exception
60+
* @throws \Magento\Framework\Exception\InputException
6161
*/
6262
public function save(
6363
\Magento\Catalog\Api\Data\ProductInterface $product,

app/code/Magento/Bundle/Model/LinkManagement.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@ public function getChildren($productId)
7171
{
7272
$product = $this->productRepository->get($productId);
7373
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
74-
throw new \Magento\Webapi\Exception(
75-
'Only implemented for bundle product',
76-
\Magento\Webapi\Exception::HTTP_FORBIDDEN
74+
throw new InputException(
75+
'Only implemented for bundle product'
7776
);
7877
}
7978

@@ -178,9 +177,8 @@ public function removeChild($productSku, $optionId, $childSku)
178177
$product = $this->productRepository->get($productSku);
179178

180179
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
181-
throw new \Magento\Webapi\Exception(
182-
sprintf('Product with specified sku: %s is not a bundle product', $productSku),
183-
\Magento\Webapi\Exception::HTTP_FORBIDDEN
180+
throw new InputException(
181+
sprintf('Product with specified sku: %s is not a bundle product', $productSku)
184182
);
185183
}
186184

app/code/Magento/Bundle/Model/OptionManagement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
namespace Magento\Bundle\Model;
88

9-
use Magento\Webapi\Exception;
9+
use Magento\Framework\Exception\InputException;
1010

1111
class OptionManagement implements \Magento\Bundle\Api\ProductOptionManagementInterface
1212
{
@@ -39,7 +39,7 @@ public function save(\Magento\Bundle\Api\Data\OptionInterface $option)
3939
{
4040
$product = $this->productRepository->get($option->getSku());
4141
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
42-
throw new Exception('Only implemented for bundle product', Exception::HTTP_FORBIDDEN);
42+
throw new InputException('Only implemented for bundle product');
4343
}
4444
return $this->optionRepository->save($product, $option);
4545
}

app/code/Magento/Bundle/Model/OptionRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
namespace Magento\Bundle\Model;
88

99
use Magento\Framework\Exception\CouldNotSaveException;
10+
use Magento\Framework\Exception\InputException;
1011
use Magento\Framework\Exception\NoSuchEntityException;
11-
use Magento\Webapi\Exception;
1212

1313
/**
1414
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -205,13 +205,13 @@ public function save(
205205
/**
206206
* @param string $productSku
207207
* @return \Magento\Catalog\Api\Data\ProductInterface
208-
* @throws Exception
208+
* @throws \Magento\Framework\Exception\InputException
209209
*/
210210
private function getProduct($productSku)
211211
{
212212
$product = $this->productRepository->get($productSku);
213213
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
214-
throw new Exception('Only implemented for bundle product', Exception::HTTP_FORBIDDEN);
214+
throw new InputException('Only implemented for bundle product');
215215
}
216216
return $product;
217217
}

app/code/Magento/Bundle/Model/Resource/Bundle.php

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,25 @@ class Bundle extends \Magento\Framework\Model\Resource\Db\AbstractDb
1818
protected $_productRelation;
1919

2020
/**
21-
* @param \Magento\Framework\App\Resource $resource
21+
* @var \Magento\Quote\Model\Resource\Quote
22+
*/
23+
protected $quoteResource;
24+
25+
/**
26+
* @param \Magento\Framework\Model\Resource\Db\Context $context
2227
* @param \Magento\Catalog\Model\Resource\Product\Relation $productRelation
28+
* @param \Magento\Quote\Model\Resource\Quote $quoteResource
29+
* @param null $resourcePrefix
2330
*/
2431
public function __construct(
25-
\Magento\Framework\App\Resource $resource,
26-
\Magento\Catalog\Model\Resource\Product\Relation $productRelation
32+
\Magento\Framework\Model\Resource\Db\Context $context,
33+
\Magento\Catalog\Model\Resource\Product\Relation $productRelation,
34+
\Magento\Quote\Model\Resource\Quote $quoteResource,
35+
$resourcePrefix = null
2736
) {
28-
parent::__construct($resource);
37+
parent::__construct($context, $resourcePrefix);
2938
$this->_productRelation = $productRelation;
39+
$this->quoteResource = $quoteResource;
3040
}
3141

3242
/**
@@ -83,8 +93,10 @@ public function getSelectionsData($productId)
8393
*/
8494
public function dropAllQuoteChildItems($productId)
8595
{
86-
$quoteItemIds = $this->_getReadAdapter()->fetchCol(
87-
$this->_getReadAdapter()->select()->from(
96+
$select = $this->quoteResource->getReadConnection()->select();
97+
$adapter = $select->getAdapter();
98+
$quoteItemIds = $adapter->fetchCol(
99+
$select->from(
88100
$this->getTable('quote_item'),
89101
['item_id']
90102
)->where(
@@ -94,7 +106,7 @@ public function dropAllQuoteChildItems($productId)
94106
);
95107

96108
if ($quoteItemIds) {
97-
$this->_getWriteAdapter()->delete(
109+
$adapter->delete(
98110
$this->getTable('quote_item'),
99111
['parent_item_id IN(?)' => $quoteItemIds]
100112
);

app/code/Magento/Bundle/Model/Resource/Option.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ class Option extends \Magento\Framework\Model\Resource\Db\AbstractDb
1818
private $validator;
1919

2020
/**
21-
* @param \Magento\Framework\App\Resource $resource
21+
* @param \Magento\Framework\Model\Resource\Db\Context $context
2222
* @param \Magento\Bundle\Model\Option\Validator $validator
23+
* @param string|null $resourcePrefix
2324
*/
2425
public function __construct(
25-
\Magento\Framework\App\Resource $resource,
26-
\Magento\Bundle\Model\Option\Validator $validator
26+
\Magento\Framework\Model\Resource\Db\Context $context,
27+
\Magento\Bundle\Model\Option\Validator $validator,
28+
$resourcePrefix = null
2729
) {
28-
parent::__construct($resource);
30+
parent::__construct($context, $resourcePrefix);
2931
$this->validator = $validator;
3032
}
3133

0 commit comments

Comments
 (0)