-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1062 from magento-jackalopes/pr-sprint-15
[Jackalopes] - Sprint 15 PR
- Loading branch information
Showing
66 changed files
with
1,185 additions
and
742 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Catalog\Setup; | ||
|
||
use Magento\Framework\DB\Select\QueryModifierFactory; | ||
use Magento\Widget\Setup\LayoutUpdateConverter; | ||
use Magento\Eav\Setup\EavSetup; | ||
use Magento\Framework\DB\FieldToConvert; | ||
use Magento\Framework\DB\AggregatedFieldDataConverter; | ||
|
||
/** | ||
* Convert serialized widget data for categories and products tables to JSON | ||
*/ | ||
class UpgradeWidgetData | ||
{ | ||
/** | ||
* @var EavSetup | ||
*/ | ||
private $eavSetup; | ||
|
||
/** | ||
* @var QueryModifierFactory | ||
*/ | ||
private $queryModifierFactory; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param EavSetup $eavSetup | ||
* @param QueryModifierFactory $queryModifierFactory | ||
* @param AggregatedFieldDataConverter $aggregatedFieldDataConverter | ||
*/ | ||
public function __construct( | ||
EavSetup $eavSetup, | ||
QueryModifierFactory $queryModifierFactory, | ||
AggregatedFieldDataConverter $aggregatedFieldDataConverter | ||
) { | ||
$this->eavSetup = $eavSetup; | ||
$this->queryModifierFactory = $queryModifierFactory; | ||
$this->aggregatedFieldDataConverter = $aggregatedFieldDataConverter; | ||
} | ||
|
||
/** | ||
* Convert category and product layout update | ||
* | ||
* @return void | ||
* @throws \InvalidArgumentException | ||
*/ | ||
public function upgrade() | ||
{ | ||
$categoryTypeId = $this->eavSetup->getEntityTypeId(\Magento\Catalog\Model\Category::ENTITY); | ||
$categoryLayoutUpdateAttribute = $this->eavSetup->getAttribute($categoryTypeId, 'custom_layout_update'); | ||
$categoryLayoutUpdateAttributeModifier = $this->queryModifierFactory->create( | ||
'in', | ||
[ | ||
'values' => [ | ||
'attribute_id' => $categoryLayoutUpdateAttribute['attribute_id'] | ||
] | ||
] | ||
); | ||
$layoutUpdateValueModifier = $this->queryModifierFactory->create( | ||
'like', | ||
[ | ||
'values' => [ | ||
'value' => '%conditions_encoded%' | ||
] | ||
] | ||
); | ||
$categoryLayoutUpdateModifier = $this->queryModifierFactory->create( | ||
'composite', | ||
[ | ||
'queryModifiers' => [ | ||
$categoryLayoutUpdateAttributeModifier, | ||
$layoutUpdateValueModifier | ||
] | ||
] | ||
); | ||
$productTypeId = $this->eavSetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); | ||
$productLayoutUpdateAttribute = $this->eavSetup->getAttribute($productTypeId, 'custom_layout_update'); | ||
$productLayoutUpdateAttributeModifier = $this->queryModifierFactory->create( | ||
'in', | ||
[ | ||
'values' => [ | ||
'attribute_id' => $productLayoutUpdateAttribute['attribute_id'] | ||
] | ||
] | ||
); | ||
$productLayoutUpdateModifier = $this->queryModifierFactory->create( | ||
'composite', | ||
[ | ||
'queryModifiers' => [ | ||
$productLayoutUpdateAttributeModifier, | ||
$layoutUpdateValueModifier | ||
] | ||
] | ||
); | ||
$this->aggregatedFieldDataConverter->convert( | ||
[ | ||
new FieldToConvert( | ||
LayoutUpdateConverter::class, | ||
$this->eavSetup->getSetup()->getTable('catalog_category_entity_text'), | ||
'value_id', | ||
'value', | ||
$categoryLayoutUpdateModifier | ||
), | ||
new FieldToConvert( | ||
LayoutUpdateConverter::class, | ||
$this->eavSetup->getSetup()->getTable('catalog_product_entity_text'), | ||
'value_id', | ||
'value', | ||
$productLayoutUpdateModifier | ||
), | ||
], | ||
$this->eavSetup->getSetup()->getConnection() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 0 additions & 98 deletions
98
...code/Magento/CatalogUrlRewrite/Test/Unit/Model/_files/categoryUrlRewritesDataProvider.php
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.