Skip to content

Commit 63c8c25

Browse files
#36346 Add regions for Czech Republic
1 parent 6057eb8 commit 63c8c25

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Directory\Setup\Patch\Data;
9+
10+
use Magento\Directory\Setup\DataInstaller;
11+
use Magento\Directory\Setup\DataInstallerFactory;
12+
use Magento\Framework\Setup\ModuleDataSetupInterface;
13+
use Magento\Framework\Setup\Patch\DataPatchInterface;
14+
15+
/**
16+
* Add Czech Republic States
17+
*/
18+
class AddDataForCzechia implements DataPatchInterface
19+
{
20+
/**
21+
* @var ModuleDataSetupInterface
22+
*/
23+
private $moduleDataSetup;
24+
25+
/**
26+
* @var DataInstallerFactory
27+
*/
28+
private $dataInstallerFactory;
29+
30+
/**
31+
* @param ModuleDataSetupInterface $moduleDataSetup
32+
* @param DataInstallerFactory $dataInstallerFactory
33+
*/
34+
public function __construct(
35+
ModuleDataSetupInterface $moduleDataSetup,
36+
DataInstallerFactory $dataInstallerFactory
37+
) {
38+
$this->moduleDataSetup = $moduleDataSetup;
39+
$this->dataInstallerFactory = $dataInstallerFactory;
40+
}
41+
42+
/**
43+
* @inheritdoc
44+
*/
45+
public function apply()
46+
{
47+
/** @var DataInstaller $dataInstaller */
48+
$dataInstaller = $this->dataInstallerFactory->create();
49+
$dataInstaller->addCountryRegions(
50+
$this->moduleDataSetup->getConnection(),
51+
$this->getDataForCzechia()
52+
);
53+
}
54+
55+
/**
56+
* Czechia states data.
57+
*
58+
* @return array
59+
*/
60+
private function getDataForCzechia()
61+
{
62+
return [
63+
['CZ', 'CZ-10', 'Praha, Hlavní město'],
64+
['CZ', 'CZ-20', 'Středočeský kraj'],
65+
['CZ', 'CZ-31', 'Jihočeský kraj'],
66+
['CZ', 'CZ-32', 'Plzeňský kraj'],
67+
['CZ', 'CZ-41', 'Karlovarský kraj'],
68+
['CZ', 'CZ-42', 'Ústecký kraj'],
69+
['CZ', 'CZ-51', 'Liberecký kraj'],
70+
['CZ', 'CZ-52', 'Královéhradecký kraj'],
71+
['CZ', 'CZ-53', 'Pardubický kraj'],
72+
['CZ', 'CZ-63', 'Kraj Vysočina'],
73+
['CZ', 'CZ-64', 'Jihomoravský kraj'],
74+
['CZ', 'CZ-71', 'Olomoucký kraj'],
75+
['CZ', 'CZ-72', 'Zlínský kraj'],
76+
['CZ', 'CZ-80', 'Moravskoslezský kraj'],
77+
];
78+
}
79+
80+
/**
81+
* @inheritdoc
82+
*/
83+
public static function getDependencies()
84+
{
85+
return [
86+
InitializeDirectoryData::class,
87+
];
88+
}
89+
90+
/**
91+
* @inheritdoc
92+
*/
93+
public function getAliases()
94+
{
95+
return [];
96+
}
97+
}

0 commit comments

Comments
 (0)