Skip to content

Commit b2547c8

Browse files
author
Nikola Lardev
committed
Adding bulgarian regions
1 parent d4a9098 commit b2547c8

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Directory\Setup\Patch\Data;
8+
9+
use Magento\Directory\Setup\DataInstaller;
10+
use Magento\Framework\App\ResourceConnection;
11+
use Magento\Framework\Setup\ModuleDataSetupInterface;
12+
use Magento\Framework\Setup\Patch\DataPatchInterface;
13+
use Magento\Framework\Setup\Patch\PatchVersionInterface;
14+
15+
/**
16+
* Class AddDataForBulgaria
17+
* @package Magento\Directory\Setup\Patch
18+
*/
19+
class AddDataForCroatia implements DataPatchInterface, PatchVersionInterface
20+
{
21+
/**
22+
* @var ModuleDataSetupInterface
23+
*/
24+
private $moduleDataSetup;
25+
26+
/**
27+
* @var \Magento\Directory\Setup\DataInstallerFactory
28+
*/
29+
private $dataInstallerFactory;
30+
31+
/**
32+
* AddDataForCroatia constructor.
33+
*
34+
* @param ModuleDataSetupInterface $moduleDataSetup
35+
* @param \Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory
36+
*/
37+
public function __construct(
38+
ModuleDataSetupInterface $moduleDataSetup,
39+
\Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory
40+
) {
41+
$this->moduleDataSetup = $moduleDataSetup;
42+
$this->dataInstallerFactory = $dataInstallerFactory;
43+
}
44+
45+
/**
46+
* {@inheritdoc}
47+
*/
48+
public function apply()
49+
{
50+
/** @var DataInstaller $dataInstaller */
51+
$dataInstaller = $this->dataInstallerFactory->create();
52+
$dataInstaller->addCountryRegions(
53+
$this->moduleDataSetup->getConnection(),
54+
$this->getDataForCroatia()
55+
);
56+
}
57+
58+
/**
59+
* Croatian states data.
60+
*
61+
* @return array
62+
*/
63+
private function getDataForCroatia()
64+
{
65+
return [
66+
['BG', 'BG-01', 'Blagoevgrad'],
67+
['BG', 'BG-02', 'Burgas'],
68+
['BG', 'BG-03', 'Varna'],
69+
['BG', 'BG-04', 'Veliko Tarnovo'],
70+
['BG', 'BG-05', 'Vidin'],
71+
['BG', 'BG-06', 'Vratsa'],
72+
['BG', 'BG-07', 'Gabrovo'],
73+
['BG', 'BG-08', 'Dobrich'],
74+
['BG', 'BG-09', 'Kardzhali'],
75+
['BG', 'BG-10', 'Kyustendil'],
76+
['BG', 'BG-11', 'Lovech'],
77+
['BG', 'BG-12', 'Montana'],
78+
['BG', 'BG-13', 'Pazardzhik'],
79+
['BG', 'BG-14', 'Pernik'],
80+
['BG', 'BG-15', 'Pleven'],
81+
['BG', 'BG-16', 'Plovdiv'],
82+
['BG', 'BG-17', 'Razgrad'],
83+
['BG', 'BG-18', 'Ruse'],
84+
['BG', 'BG-19', 'Silistra'],
85+
['BG', 'BG-20', 'Sliven'],
86+
['BG', 'BG-21', 'Smolyan'],
87+
['BG', 'BG-22', 'Sofia City'],
88+
['BG', 'BG-23', 'Sofia Province'],
89+
['BG', 'BG-24', 'Stara Zagora'],
90+
['BG', 'BG-25', 'Targovishte'],
91+
['BG', 'BG-26', 'Haskovo'],
92+
['BG', 'BG-27', 'Shumen'],
93+
['BG', 'BG-28', 'Yambol'],
94+
];
95+
}
96+
97+
/**
98+
* {@inheritdoc}
99+
*/
100+
public static function getDependencies()
101+
{
102+
return [
103+
InitializeDirectoryData::class,
104+
];
105+
}
106+
107+
/**
108+
* {@inheritdoc}
109+
*/
110+
public static function getVersion()
111+
{
112+
return '';
113+
}
114+
115+
/**
116+
* {@inheritdoc}
117+
*/
118+
public function getAliases()
119+
{
120+
return [];
121+
}
122+
}

0 commit comments

Comments
 (0)