PrepareRuleModelSerializedData.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\SalesRule\Setup\Patch\Data;
  7. use Magento\Framework\Setup\ModuleDataSetupInterface;
  8. use Magento\Framework\Setup\Patch\DataPatchInterface;
  9. use Magento\Framework\Setup\Patch\PatchVersionInterface;
  10. /**
  11. * Class PrepareRuleModelSerializedData
  12. *
  13. * @package Magento\SalesRule\Setup\Patch
  14. */
  15. class PrepareRuleModelSerializedData implements DataPatchInterface, PatchVersionInterface
  16. {
  17. /**
  18. * @var ModuleDataSetupInterface
  19. */
  20. private $moduleDataSetup;
  21. /**
  22. * PatchInitial constructor.
  23. * @param ModuleDataSetupInterface $moduleDataSetup
  24. */
  25. public function __construct(
  26. ModuleDataSetupInterface $moduleDataSetup
  27. ) {
  28. $this->moduleDataSetup = $moduleDataSetup;
  29. }
  30. /**
  31. * @inheritdoc
  32. */
  33. public function apply()
  34. {
  35. $installer = $this->moduleDataSetup->createMigrationSetup();
  36. $this->moduleDataSetup->startSetup();
  37. $installer->appendClassAliasReplace(
  38. 'salesrule',
  39. 'conditions_serialized',
  40. \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL,
  41. \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED,
  42. ['rule_id']
  43. );
  44. $installer->appendClassAliasReplace(
  45. 'salesrule',
  46. 'actions_serialized',
  47. \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL,
  48. \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED,
  49. ['rule_id']
  50. );
  51. $installer->doUpdateClassAliases();
  52. $this->moduleDataSetup->endSetup();
  53. }
  54. /**
  55. * @inheritdoc
  56. */
  57. public static function getDependencies()
  58. {
  59. return [];
  60. }
  61. /**
  62. * @inheritdoc
  63. */
  64. public static function getVersion()
  65. {
  66. return '2.0.0';
  67. }
  68. /**
  69. * @inheritdoc
  70. */
  71. public function getAliases()
  72. {
  73. return [];
  74. }
  75. }