Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NextChainPatch.php
Go to the documentation of this file.
1 <?php
7 
12 
16 class NextChainPatch implements
20 {
24  private $resourceConnection;
25 
30  public function __construct(ResourceConnection $resourceConnection)
31  {
32  $this->resourceConnection = $resourceConnection;
33  }
34 
38  public static function getVersion()
39  {
40  return '0.0.6';
41  }
42 
46  public function getAliases()
47  {
48  return [];
49  }
50 
54  public function apply()
55  {
56  $adapter = $this->resourceConnection->getConnection();
57  $refSelect = $adapter->select()->from('reference_table', 'for_patch_testing')
58  ->where('`tinyint_ref` = ?', 7);
59  $varchar2 = $adapter->fetchOne($refSelect);
60  $adapter->update(
61  'reference_table',
62  ['for_patch_testing' => 'changed__' . $varchar2],
63  ['`tinyint_ref` = ?' => 7]
64  );
65  }
66 
67  public function revert()
68  {
69  $adapter = $this->resourceConnection->getConnection();
70  $refSelect = $adapter->select()->from('reference_table', 'for_patch_testing')
71  ->where('`tinyint_ref` = ?', 7);
72  $varchar2 = $adapter->fetchOne($refSelect);
73  $adapter->update(
74  'reference_table',
75  ['for_patch_testing' => str_replace('changed__', '', $varchar2)],
76  ['`tinyint_ref` = ?' => 7]
77  );
78  }
79 
83  public static function getDependencies()
84  {
85  return [
86  LlNextChainPatch::class,
87  ZFirstPatch::class
88  ];
89  }
90 }
$adapter
Definition: webapi_user.php:16