Skip to content

Commit 766f060

Browse files
author
Tulika,Eugene(etulika)
committed
Merge pull request #151 from magento-api/Merged-Branches-Sprint-44
[API] Sprint 44 - Part 1
2 parents 35e643f + 1b619db commit 766f060

File tree

402 files changed

+2661
-2759
lines changed

Some content is hidden

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

402 files changed

+2661
-2759
lines changed

app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,56 @@
88

99
class ListAction extends \Magento\Backend\App\AbstractAction
1010
{
11+
/**
12+
* @var \Magento\Framework\Json\Helper\Data
13+
*/
14+
protected $jsonHelper;
15+
16+
/**
17+
* @var \Magento\AdminNotification\Model\Resource\System\Message\Collection
18+
*/
19+
protected $messageCollection;
20+
21+
/**
22+
* Initialize ListAction
23+
*
24+
* @param \Magento\Backend\App\Action\Context $context
25+
* @param \Magento\Framework\Json\Helper\Data $jsonHelper
26+
* @param \Magento\AdminNotification\Model\Resource\System\Message\Collection $messageCollection
27+
*/
28+
public function __construct(
29+
\Magento\Backend\App\Action\Context $context,
30+
\Magento\Framework\Json\Helper\Data $jsonHelper,
31+
\Magento\AdminNotification\Model\Resource\System\Message\Collection $messageCollection
32+
) {
33+
$this->jsonHelper = $jsonHelper;
34+
$this->messageCollection = $messageCollection;
35+
parent::__construct($context);
36+
}
37+
1138
/**
1239
* @return void
1340
*/
1441
public function execute()
1542
{
1643
$severity = $this->getRequest()->getParam('severity');
17-
$messageCollection = $this->_objectManager->get(
18-
'Magento\AdminNotification\Model\Resource\System\Message\Collection'
19-
);
2044
if ($severity) {
21-
$messageCollection->setSeverity($severity);
45+
$this->messageCollection->setSeverity($severity);
2246
}
2347
$result = [];
24-
foreach ($messageCollection->getItems() as $item) {
25-
$result[] = ['severity' => $item->getSeverity(), 'text' => $item->getText()];
48+
foreach ($this->messageCollection->getItems() as $item) {
49+
$result[] = [
50+
'severity' => $item->getSeverity(),
51+
'text' => $item->getText(),
52+
];
53+
}
54+
if (empty($result)) {
55+
$result[] = [
56+
'severity' => (string)\Magento\Framework\Notification\MessageInterface::SEVERITY_NOTICE,
57+
'text' => 'You have viewed and resolved all recent system notices. '
58+
. 'Please refresh the web page to clear the notice alert.',
59+
];
2660
}
27-
$this->getResponse()->representJson(
28-
$this->_objectManager->get('Magento\Framework\Json\Helper\Data')->jsonEncode($result)
29-
);
61+
$this->getResponse()->representJson($this->jsonHelper->jsonEncode($result));
3062
}
3163
}

app/code/Magento/AdminNotification/etc/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd">
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd">
99
<default>
1010
<system>
1111
<adminnotification>

app/code/Magento/AdminNotification/etc/module.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
99
<module name="Magento_AdminNotification" setup_version="2.0.0">
1010
<sequence>
11-
<module name="Magento_Core"/>
1211
<module name="Magento_Store"/>
1312
</sequence>
1413
</module>

app/code/Magento/Authorization/Setup/InstallData.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,17 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
8585
$rule->setData('resource_id', 'Magento_Backend::all')->save();
8686
}
8787
}
88+
89+
/**
90+
* Delete rows by condition from authorization_rule
91+
*/
92+
$setup->startSetup();
93+
94+
$tableName = $setup->getTable('authorization_rule');
95+
if ($tableName) {
96+
$setup->getConnection()->delete($tableName, ['resource_id = ?' => 'admin/system/tools/compiler']);
97+
}
98+
99+
$setup->endSetup();
88100
}
89101
}

app/code/Magento/Backend/etc/adminhtml/menu.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<menu>
1010
<add id="Magento_Backend::system_design_schedule" title="Schedule" module="Magento_Backend" sortOrder="30" parent="Magento_Backend::system_design" action="adminhtml/system_design" resource="Magento_Backend::schedule"/>
1111
<add id="Magento_Backend::system_currency" title="Currency" module="Magento_Backend" sortOrder="30" parent="Magento_Backend::stores" action="adminhtml/system_currency" resource="Magento_CurrencySymbol::system_currency"/>
12-
<add id="Magento_Backend::system_store" title="All Stores" module="Magento_Core" sortOrder="10" parent="Magento_Backend::stores_settings" action="adminhtml/system_store/" resource="Magento_Backend::store"/>
12+
<add id="Magento_Backend::system_store" title="All Stores" module="Magento_Backend" sortOrder="10" parent="Magento_Backend::stores_settings" action="adminhtml/system_store/" resource="Magento_Backend::store"/>
1313
<add id="Magento_Backend::dashboard" title="Dashboard" module="Magento_Backend" sortOrder="10" action="adminhtml/dashboard" resource="Magento_Backend::dashboard"/>
1414
<add id="Magento_Backend::system" title="System" module="Magento_Backend" sortOrder="80" resource="Magento_Backend::system"/>
1515
<add id="Magento_Backend::system_tools" title="Tools" module="Magento_Backend" sortOrder="50" parent="Magento_Backend::system" resource="Magento_Backend::tools"/>

app/code/Magento/Backend/etc/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd">
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd">
99
<default>
1010
<system>
1111
<media_storage_configuration>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ public function getChildren($productId);
2121
/**
2222
* Add child product to specified Bundle option by product sku
2323
*
24-
* @param string $productSku
24+
* @param string $sku
2525
* @param int $optionId
2626
* @param \Magento\Bundle\Api\Data\LinkInterface $linkedProduct
2727
* @throws \Magento\Framework\Exception\NoSuchEntityException
2828
* @throws \Magento\Framework\Exception\CouldNotSaveException
2929
* @throws \Magento\Framework\Exception\InputException
3030
* @return int
3131
*/
32-
public function addChildByProductSku($productSku, $optionId, \Magento\Bundle\Api\Data\LinkInterface $linkedProduct);
32+
public function addChildByProductSku($sku, $optionId, \Magento\Bundle\Api\Data\LinkInterface $linkedProduct);
3333

3434
/**
3535
* @param \Magento\Catalog\Api\Data\ProductInterface $product
@@ -49,12 +49,12 @@ public function addChild(
4949
/**
5050
* Remove product from Bundle product option
5151
*
52-
* @param string $productSku
52+
* @param string $sku
5353
* @param int $optionId
5454
* @param string $childSku
5555
* @throws \Magento\Framework\Exception\NoSuchEntityException
5656
* @throws \Magento\Framework\Exception\InputException
5757
* @return bool
5858
*/
59-
public function removeChild($productSku, $optionId, $childSku);
59+
public function removeChild($sku, $optionId, $childSku);
6060
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ interface ProductOptionRepositoryInterface
1111
/**
1212
* Get option for bundle product
1313
*
14-
* @param string $productSku
14+
* @param string $sku
1515
* @param int $optionId
1616
* @return \Magento\Bundle\Api\Data\OptionInterface
1717
* @throws \Magento\Framework\Exception\NoSuchEntityException
1818
* @throws \Magento\Framework\Exception\InputException
1919
*/
20-
public function get($productSku, $optionId);
20+
public function get($sku, $optionId);
2121

2222
/**
2323
* Get all options for bundle product
2424
*
25-
* @param string $productSku
25+
* @param string $sku
2626
* @return \Magento\Bundle\Api\Data\OptionInterface[]
2727
* @throws \Magento\Framework\Exception\NoSuchEntityException
2828
* @throws \Magento\Framework\Exception\InputException
2929
*/
30-
public function getList($productSku);
30+
public function getList($sku);
3131

3232
/**
3333
* Remove bundle option
@@ -42,13 +42,13 @@ public function delete(\Magento\Bundle\Api\Data\OptionInterface $option);
4242
/**
4343
* Remove bundle option
4444
*
45-
* @param string $productSku
45+
* @param string $sku
4646
* @param int $optionId
4747
* @return bool
4848
* @throws \Magento\Framework\Exception\CouldNotSaveException
4949
* @throws \Magento\Framework\Exception\InputException
5050
*/
51-
public function deleteById($productSku, $optionId);
51+
public function deleteById($sku, $optionId);
5252

5353
/**
5454
* Add new option for bundle product

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ public function getChildren($productId)
9797
/**
9898
* {@inheritdoc}
9999
*/
100-
public function addChildByProductSku($productSku, $optionId, \Magento\Bundle\Api\Data\LinkInterface $linkedProduct)
100+
public function addChildByProductSku($sku, $optionId, \Magento\Bundle\Api\Data\LinkInterface $linkedProduct)
101101
{
102102
/** @var \Magento\Catalog\Model\Product $product */
103-
$product = $this->productRepository->get($productSku);
103+
$product = $this->productRepository->get($sku);
104104
return $this->addChild($product, $optionId, $linkedProduct);
105105
}
106106

@@ -180,13 +180,13 @@ public function addChild(
180180
/**
181181
* {@inheritdoc}
182182
*/
183-
public function removeChild($productSku, $optionId, $childSku)
183+
public function removeChild($sku, $optionId, $childSku)
184184
{
185-
$product = $this->productRepository->get($productSku);
185+
$product = $this->productRepository->get($sku);
186186

187187
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
188188
throw new InputException(
189-
sprintf('Product with specified sku: %s is not a bundle product', $productSku)
189+
sprintf('Product with specified sku: %s is not a bundle product', $sku)
190190
);
191191
}
192192

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ public function __construct(
9696
/**
9797
* {@inheritdoc}
9898
*/
99-
public function get($productSku, $optionId)
99+
public function get($sku, $optionId)
100100
{
101-
$product = $this->getProduct($productSku);
101+
$product = $this->getProduct($sku);
102102

103103
/** @var \Magento\Bundle\Model\Option $option */
104104
$option = $this->type->getOptionsCollection($product)->getItemById($optionId);
@@ -126,9 +126,9 @@ public function get($productSku, $optionId)
126126
/**
127127
* {@inheritdoc}
128128
*/
129-
public function getList($productSku)
129+
public function getList($sku)
130130
{
131-
$product = $this->getProduct($productSku);
131+
$product = $this->getProduct($sku);
132132
return $this->productOptionList->getItems($product);
133133
}
134134

@@ -152,9 +152,9 @@ public function delete(\Magento\Bundle\Api\Data\OptionInterface $option)
152152
/**
153153
* {@inheritdoc}
154154
*/
155-
public function deleteById($productSku, $optionId)
155+
public function deleteById($sku, $optionId)
156156
{
157-
$product = $this->getProduct($productSku);
157+
$product = $this->getProduct($sku);
158158
$optionCollection = $this->type->getOptionsCollection($product);
159159
$optionCollection->setIdFilter($optionId);
160160
return $this->delete($optionCollection->getFirstItem());
@@ -217,13 +217,13 @@ public function save(
217217
}
218218

219219
/**
220-
* @param string $productSku
220+
* @param string $sku
221221
* @return \Magento\Catalog\Api\Data\ProductInterface
222222
* @throws \Magento\Framework\Exception\InputException
223223
*/
224-
private function getProduct($productSku)
224+
private function getProduct($sku)
225225
{
226-
$product = $this->productRepository->get($productSku);
226+
$product = $this->productRepository->get($sku);
227227
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
228228
throw new InputException('Only implemented for bundle product');
229229
}

0 commit comments

Comments
 (0)