-
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 branch 'develop' of https://github.corp.ebay.com/magento2/magen…
…to2ce into develop
- Loading branch information
Showing
10 changed files
with
127 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Catalog\Setup; | ||
|
||
use Magento\Framework\Setup\UpgradeDataInterface; | ||
use Magento\Framework\Setup\ModuleContextInterface; | ||
use Magento\Framework\Setup\ModuleDataSetupInterface; | ||
use Magento\Catalog\Model\Category; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
class UpgradeData implements UpgradeDataInterface | ||
{ | ||
/** | ||
* @var Category | ||
*/ | ||
protected $category; | ||
|
||
/** | ||
* @param Category $category | ||
*/ | ||
public function __construct(Category $category) | ||
{ | ||
$this->category = $category; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) | ||
{ | ||
if (version_compare($context->getVersion(), '2.0.0.2') < 0) { | ||
$newBackendModel = 'Magento\Catalog\Model\Attribute\Backend\Startdate'; | ||
$connection = $setup->getConnection(); | ||
$connection->startSetup(); | ||
$connection->update( | ||
$setup->getTable('eav_attribute'), | ||
['backend_model' => $newBackendModel], | ||
['backend_model = ?' => 'Magento\Catalog\Model\Product\Attribute\Backend\Startdate'] | ||
); | ||
/** @var \Magento\Catalog\Model\Resource\Eav\Attribute $attribute */ | ||
foreach ($this->category->getAttributes() as $attribute) { | ||
if ($attribute->getAttributeCode() == 'custom_design_from') { | ||
$attribute->setBackendModel($newBackendModel); | ||
$attribute->save(); | ||
break; | ||
} | ||
} | ||
$connection->endSetup(); | ||
} | ||
} | ||
} |
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
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
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
Oops, something went wrong.