Skip to content

Commit fa95e33

Browse files
authored
ENGCOM-8244: Add Regions for Uruguay. #29722
2 parents a542dc8 + 7a48783 commit fa95e33

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
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 Uruguay States/Regions
17+
*/
18+
class AddDataForUruguay 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->getDataForUruguay()
52+
);
53+
54+
return $this;
55+
}
56+
57+
/**
58+
* Uruguay states data.
59+
*
60+
* @return array
61+
*/
62+
private function getDataForUruguay(): array
63+
{
64+
return [
65+
['UY', 'UY-AR', 'Artigas'],
66+
['UY', 'UY-CA', 'Canelones'],
67+
['UY', 'UY-CL', 'Cerro Largo'],
68+
['UY', 'UY-CO', 'Colonia'],
69+
['UY', 'UY-DU', 'Durazno'],
70+
['UY', 'UY-FS', 'Flores'],
71+
['UY', 'UY-FD', 'Florida'],
72+
['UY', 'UY-LA', 'Lavalleja'],
73+
['UY', 'UY-MA', 'Maldonado'],
74+
['UY', 'UY-MO', 'Montevideo'],
75+
['UY', 'UY-PA', 'Paysandu'],
76+
['UY', 'UY-RN', 'Río Negro'],
77+
['UY', 'UY-RV', 'Rivera'],
78+
['UY', 'UY-RO', 'Rocha'],
79+
['UY', 'UY-SA', 'Salto'],
80+
['UY', 'UY-SJ', 'San José'],
81+
['UY', 'UY-SO', 'Soriano'],
82+
['UY', 'UY-TA', 'Tacuarembó'],
83+
['UY', 'UY-TT', 'Treinta y Tres']
84+
];
85+
}
86+
87+
/**
88+
* @inheritdoc
89+
*/
90+
public static function getDependencies()
91+
{
92+
return [
93+
InitializeDirectoryData::class,
94+
];
95+
}
96+
97+
/**
98+
* @inheritdoc
99+
*/
100+
public function getAliases()
101+
{
102+
return [];
103+
}
104+
}

0 commit comments

Comments
 (0)