Skip to content

Commit a9f499e

Browse files
committed
feature/25312 Add Colombian regions
1 parent 68d2137 commit a9f499e

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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 AddDataForColombia
17+
*/
18+
class AddDataForColombia 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->getDataForColombia()
52+
);
53+
}
54+
55+
/**
56+
* Colombia states data.
57+
*
58+
* @return array
59+
*/
60+
private function getDataForColombia()
61+
{
62+
return [
63+
['CO', 'CO-AMA', 'Amazonas'],
64+
['CO', 'CO-ANT', 'Antioquia'],
65+
['CO', 'CO-ARA', 'Arauca'],
66+
['CO', 'CO-ATL', 'Atlántico'],
67+
['CO', 'CO-BOL', 'Bolívar'],
68+
['CO', 'CO-BOY', 'Boyacá'],
69+
['CO', 'CO-CAL', 'Caldas'],
70+
['CO', 'CO-CAQ', 'Caquetá'],
71+
['CO', 'CO-CAS', 'Casanare'],
72+
['CO', 'CO-CAU', 'Cauca'],
73+
['CO', 'CO-CES', 'Cesar'],
74+
['CO', 'CO-CHO', 'Chocó'],
75+
['CO', 'CO-COR', 'Córdoba'],
76+
['CO', 'CO-CUN', 'Cundinamarca'],
77+
['CO', 'CO-GUA', 'Guainía'],
78+
['CO', 'CO-GUV', 'Guaviare'],
79+
['CO', 'CO-HUL', 'Huila'],
80+
['CO', 'CO-LAG', 'La Guajira'],
81+
['CO', 'CO-MAG', 'Magdalena'],
82+
['CO', 'CO-MET', 'Meta'],
83+
['CO', 'CO-NAR', 'Nariño'],
84+
['CO', 'CO-NSA', 'Norte de Santander'],
85+
['CO', 'CO-PUT', 'Putumayo'],
86+
['CO', 'CO-QUI', 'Quindío'],
87+
['CO', 'CO-RIS', 'Risaralda'],
88+
['CO', 'CO-SAP', 'San Andrés y Providencia'],
89+
['CO', 'CO-SAN', 'Santander'],
90+
['CO', 'CO-SUC', 'Sucre'],
91+
['CO', 'CO-TOL', 'Tolima'],
92+
['CO', 'CO-VAC', 'Valle del Cauca'],
93+
['CO', 'CO-VAU', 'Vaupés'],
94+
['CO', 'CO-VID', 'Vichada'],
95+
];
96+
}
97+
98+
/**
99+
* @inheritdoc
100+
*/
101+
public static function getDependencies()
102+
{
103+
return [
104+
InitializeDirectoryData::class,
105+
];
106+
}
107+
108+
/**
109+
* @inheritdoc
110+
*/
111+
public function getAliases()
112+
{
113+
return [];
114+
}
115+
}

0 commit comments

Comments
 (0)