Skip to content

Commit 4f747b8

Browse files
committed
Add Poland regions
1 parent 54742d5 commit 4f747b8

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See PLPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Directory\Setup\Patch\Data;
10+
11+
use Magento\Directory\Setup\DataInstaller;
12+
use Magento\Directory\Setup\DataInstallerFactory;
13+
use Magento\Framework\Setup\ModuleDataSetupInterface;
14+
use Magento\Framework\Setup\Patch\DataPatchInterface;
15+
16+
/**
17+
* Add Poland States
18+
*/
19+
class AddDataForPoland implements DataPatchInterface
20+
{
21+
/**
22+
* @var ModuleDataSetupInterface
23+
*/
24+
private $moduleDataSetup;
25+
26+
/**
27+
* @var DataInstallerFactory
28+
*/
29+
private $dataInstallerFactory;
30+
31+
/**
32+
* @param ModuleDataSetupInterface $moduleDataSetup
33+
* @param DataInstallerFactory $dataInstallerFactory
34+
*/
35+
public function __construct(
36+
ModuleDataSetupInterface $moduleDataSetup,
37+
DataInstallerFactory $dataInstallerFactory
38+
) {
39+
$this->moduleDataSetup = $moduleDataSetup;
40+
$this->dataInstallerFactory = $dataInstallerFactory;
41+
}
42+
43+
/**
44+
* @inheritdoc
45+
*/
46+
public function apply()
47+
{
48+
/** @var DataInstaller $dataInstaller */
49+
$dataInstaller = $this->dataInstallerFactory->create();
50+
$dataInstaller->addCountryRegions(
51+
$this->moduleDataSetup->getConnection(),
52+
$this->getDataForPoland()
53+
);
54+
}
55+
56+
/**
57+
* Poland states data.
58+
*
59+
* @return array
60+
*/
61+
private function getDataForPoland()
62+
{
63+
return [
64+
['PL', 'PL-02', 'dolnośląskie'],
65+
['PL', 'PL-04', 'kujawsko-pomorskie'],
66+
['PL', 'PL-06', 'lubelskie'],
67+
['PL', 'PL-08', 'lubuskie'],
68+
['PL', 'PL-10', 'łódzkie'],
69+
['PL', 'PL-12', 'małopolskie'],
70+
['PL', 'PL-14', 'mazowieckie'],
71+
['PL', 'PL-16', 'opolskie'],
72+
['PL', 'PL-18', 'podkarpackie'],
73+
['PL', 'PL-20', 'podlaskie'],
74+
['PL', 'PL-22', 'pomorskie'],
75+
['PL', 'PL-24', 'śląskie'],
76+
['PL', 'PL-26', 'świętokrzyskie'],
77+
['PL', 'PL-28', 'warmińsko-mazurskie'],
78+
['PL', 'PL-30', 'wielkopolskie'],
79+
['PL', 'PL-32', 'zachodniopomorskie'],
80+
];
81+
}
82+
83+
/**
84+
* @inheritdoc
85+
*/
86+
public static function getDependencies()
87+
{
88+
return [
89+
InitializeDirectoryData::class,
90+
];
91+
}
92+
93+
/**
94+
* @inheritdoc
95+
*/
96+
public function getAliases()
97+
{
98+
return [];
99+
}
100+
}

0 commit comments

Comments
 (0)