Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
OnUpdate.php
Go to the documentation of this file.
1 <?php
8 
11 
18 {
23  public function toDefinition(ElementInterface $column)
24  {
25  if ($column instanceof \Magento\Framework\Setup\Declaration\Schema\Dto\Columns\Timestamp) {
26  return $column->getOnUpdate() ?
27  'ON UPDATE CURRENT_TIMESTAMP' : '';
28  }
29 
30  return '';
31  }
32 
36  public function fromDefinition(array $data)
37  {
38  $matches = [];
39  if (preg_match('/^(?:on update)\s([\_\-\s\w\d]+)/', $data['extra'], $matches)) {
40  $data['on_update'] = true;
41  }
42 
43  return $data;
44  }
45 }