Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AddDataForIndia.php
Go to the documentation of this file.
1 <?php
8 
14 
20 {
24  private $moduleDataSetup;
25 
29  private $dataInstallerFactory;
30 
37  public function __construct(
38  ModuleDataSetupInterface $moduleDataSetup,
39  \Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory
40  ) {
41  $this->moduleDataSetup = $moduleDataSetup;
42  $this->dataInstallerFactory = $dataInstallerFactory;
43  }
44 
48  public function apply()
49  {
51  $dataInstaller = $this->dataInstallerFactory->create();
52  $dataInstaller->addCountryRegions(
53  $this->moduleDataSetup->getConnection(),
54  $this->getDataForIndia()
55  );
56  }
57 
63  private function getDataForIndia()
64  {
65  return [
66  ['IN', 'AN', 'Andaman and Nicobar Islands'],
67  ['IN', 'AP', 'Andhra Pradesh'],
68  ['IN', 'AR', 'Arunachal Pradesh'],
69  ['IN', 'AS', 'Assam'],
70  ['IN', 'BR', 'Bihar'],
71  ['IN', 'CH', 'Chandigarh'],
72  ['IN', 'CT', 'Chhattisgarh'],
73  ['IN', 'DN', 'Dadra and Nagar Haveli'],
74  ['IN', 'DD', 'Daman and Diu'],
75  ['IN', 'DL', 'Delhi'],
76  ['IN', 'GA', 'Goa'],
77  ['IN', 'GJ', 'Gujarat'],
78  ['IN', 'HR', 'Haryana'],
79  ['IN', 'HP', 'Himachal Pradesh'],
80  ['IN', 'JK', 'Jammu and Kashmir'],
81  ['IN', 'JH', 'Jharkhand'],
82  ['IN', 'KA', 'Karnataka'],
83  ['IN', 'KL', 'Kerala'],
84  ['IN', 'LD', 'Lakshadweep'],
85  ['IN', 'MP', 'Madhya Pradesh'],
86  ['IN', 'MH', 'Maharashtra'],
87  ['IN', 'MN', 'Manipur'],
88  ['IN', 'ML', 'Meghalaya'],
89  ['IN', 'MZ', 'Mizoram'],
90  ['IN', 'NL', 'Nagaland'],
91  ['IN', 'OR', 'Odisha'],
92  ['IN', 'PY', 'Puducherry'],
93  ['IN', 'PB', 'Punjab'],
94  ['IN', 'RJ', 'Rajasthan'],
95  ['IN', 'SK', 'Sikkim'],
96  ['IN', 'TN', 'Tamil Nadu'],
97  ['IN', 'TG', 'Telangana'],
98  ['IN', 'TR', 'Tripura'],
99  ['IN', 'UP', 'Uttar Pradesh'],
100  ['IN', 'UT', 'Uttarakhand'],
101  ['IN', 'WB', 'West Bengal']
102  ];
103  }
104 
108  public static function getDependencies()
109  {
110  return [
111  InitializeDirectoryData::class,
112  ];
113  }
114 
118  public static function getVersion()
119  {
120  return '2.0.2';
121  }
122 
126  public function getAliases()
127  {
128  return [];
129  }
130 }
__construct(ModuleDataSetupInterface $moduleDataSetup, \Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory)