Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AddSecurityTrackingAttributes.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Customer\Setup\CustomerSetupFactory;
15 
21 {
25  private $moduleDataSetup;
26 
30  private $customerSetupFactory;
31 
37  public function __construct(
38  ModuleDataSetupInterface $moduleDataSetup,
39  CustomerSetupFactory $customerSetupFactory
40  ) {
41  $this->moduleDataSetup = $moduleDataSetup;
42  $this->customerSetupFactory = $customerSetupFactory;
43  }
44 
48  public function apply()
49  {
50  $customerSetup = $this->customerSetupFactory->create(['setup' => $this->moduleDataSetup]);
51  $customerSetup->addAttribute(
53  'failures_num',
54  [
55  'type' => 'static',
56  'label' => 'Failures Number',
57  'input' => 'hidden',
58  'required' => false,
59  'sort_order' => 100,
60  'visible' => false,
61  'system' => true,
62  ]
63  );
64 
65  $customerSetup->addAttribute(
67  'first_failure',
68  [
69  'type' => 'static',
70  'label' => 'First Failure Date',
71  'input' => 'date',
72  'required' => false,
73  'sort_order' => 110,
74  'visible' => false,
75  'system' => true,
76  ]
77  );
78 
79  $customerSetup->addAttribute(
81  'lock_expires',
82  [
83  'type' => 'static',
84  'label' => 'Failures Number',
85  'input' => 'date',
86  'required' => false,
87  'sort_order' => 120,
88  'visible' => false,
89  'system' => true,
90  ]
91  );
92  $configTable = $this->moduleDataSetup->getTable('core_config_data');
93 
94  $this->moduleDataSetup->getConnection()->update(
95  $configTable,
96  ['value' => new \Zend_Db_Expr('value*24')],
98  );
99  }
100 
104  public static function getDependencies()
105  {
106  return [
107  RemoveCheckoutRegisterAndUpdateAttributes::class,
108  ];
109  }
110 
114  public static function getVersion()
115  {
116  return '2.0.7';
117  }
118 
122  public function getAliases()
123  {
124  return [];
125  }
126 }
const XML_PATH_CUSTOMER_RESET_PASSWORD_LINK_EXPIRATION_PERIOD
Definition: Customer.php:86
__construct(ModuleDataSetupInterface $moduleDataSetup, CustomerSetupFactory $customerSetupFactory)