Skip to content

Commit b7cec7d

Browse files
committed
Add Regions for Uruguay.
1 parent 8b7d949 commit b7cec7d

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.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\Framework\Setup\ModuleDataSetupInterface;
13+
use Magento\Framework\Setup\Patch\DataPatchInterface;
14+
15+
/**
16+
* Class AddDataForUruguay
17+
*/
18+
class AddDataForUruguay implements DataPatchInterface
19+
{
20+
/**
21+
* @var ModuleDataSetupInterface
22+
*/
23+
private $moduleDataSetup;
24+
25+
/**
26+
* @var \Magento\Directory\Setup\DataInstallerFactory
27+
*/
28+
private $dataInstallerFactory;
29+
30+
/**
31+
* @param ModuleDataSetupInterface $moduleDataSetup
32+
* @param \Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory
33+
*/
34+
public function __construct(
35+
ModuleDataSetupInterface $moduleDataSetup,
36+
\Magento\Directory\Setup\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+
55+
/**
56+
* Uruguay states data.
57+
*
58+
* @return array
59+
*/
60+
private function getDataForUruguay()
61+
{
62+
return [
63+
['UY', 'UY-AR', 'Artigas'],
64+
['UY', 'UY-CA', 'Canelones'],
65+
['UY', 'UY-CL', 'Cerro Largo'],
66+
['UY', 'UY-CO', 'Colonia'],
67+
['UY', 'UY-DU', 'Durazno'],
68+
['UY', 'UY-FS', 'Flores'],
69+
['UY', 'UY-FD', 'Florida'],
70+
['UY', 'UY-LA', 'Lavalleja'],
71+
['UY', 'UY-MA', 'Maldonado'],
72+
['UY', 'UY-MO', 'Montevideo'],
73+
['UY', 'UY-PA', 'Paysandu'],
74+
['UY', 'UY-RN', 'Río Negro'],
75+
['UY', 'UY-RV', 'Rivera'],
76+
['UY', 'UY-RO', 'Rocha'],
77+
['UY', 'UY-SA', 'Salto'],
78+
['UY', 'UY-SJ', 'San José'],
79+
['UY', 'UY-SO', 'Soriano'],
80+
['UY', 'UY-TA', 'Tacuarembó'],
81+
['UY', 'UY-TT', 'Treinta y Tres']
82+
];
83+
}
84+
85+
/**
86+
* @inheritdoc
87+
*/
88+
public static function getDependencies()
89+
{
90+
return [
91+
InitializeDirectoryData::class,
92+
];
93+
}
94+
95+
/**
96+
* @inheritdoc
97+
*/
98+
public function getAliases()
99+
{
100+
return [];
101+
}
102+
}

0 commit comments

Comments
 (0)