Skip to content

Commit f3dfb04

Browse files
ENGCOM-8685: Feature south america country regions #31158
- Merge Pull Request #31158 from nikolalardev/magento2:feature-south-america-country-regions - Merged commits: 1. d21a4fd 2. b9ae691 3. 4f31d59 4. f86e254 5. d127413
2 parents c9242e8 + d127413 commit f3dfb04

File tree

10 files changed

+955
-0
lines changed

10 files changed

+955
-0
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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 Argentina States
17+
*/
18+
class AddDataForArgentina implements DataPatchInterface
19+
{
20+
/**
21+
* @var ModuleDataSetupInterface
22+
*/
23+
private $moduleDataSetup;
24+
25+
/**
26+
* @var DataInstallerFactory
27+
*/
28+
private $dataInstallerFactory;
29+
30+
/**
31+
* AddDataForArgentina constructor.
32+
*
33+
* @param ModuleDataSetupInterface $moduleDataSetup
34+
* @param DataInstallerFactory $dataInstallerFactory
35+
*/
36+
public function __construct(
37+
ModuleDataSetupInterface $moduleDataSetup,
38+
DataInstallerFactory $dataInstallerFactory
39+
) {
40+
$this->moduleDataSetup = $moduleDataSetup;
41+
$this->dataInstallerFactory = $dataInstallerFactory;
42+
}
43+
44+
/**
45+
* @inheritdoc
46+
*/
47+
public function apply()
48+
{
49+
/** @var DataInstaller $dataInstaller */
50+
$dataInstaller = $this->dataInstallerFactory->create();
51+
$dataInstaller->addCountryRegions(
52+
$this->moduleDataSetup->getConnection(),
53+
$this->getDataForArgentina()
54+
);
55+
56+
return $this;
57+
}
58+
59+
/**
60+
* Argentina states data.
61+
*
62+
* @return array
63+
*/
64+
private function getDataForArgentina()
65+
{
66+
return [
67+
['AR', 'AR-C', 'Ciudad Autónoma de Buenos Aires'],
68+
['AR', 'AR-B', 'Buenos Aires'],
69+
['AR', 'AR-K', 'Catamarca'],
70+
['AR', 'AR-H', 'Chaco'],
71+
['AR', 'AR-U', 'Chubut'],
72+
['AR', 'AR-X', 'Córdoba'],
73+
['AR', 'AR-W', 'Corrientes'],
74+
['AR', 'AR-E', 'Entre Ríos'],
75+
['AR', 'AR-P', 'Formosa'],
76+
['AR', 'AR-Y', 'Jujuy'],
77+
['AR', 'AR-L', 'La Pampa'],
78+
['AR', 'AR-F', 'La Rioja'],
79+
['AR', 'AR-M', 'Mendoza'],
80+
['AR', 'AR-N', 'Misiones'],
81+
['AR', 'AR-Q', 'Neuquén'],
82+
['AR', 'AR-R', 'Río Negro'],
83+
['AR', 'AR-A', 'Salta'],
84+
['AR', 'AR-J', 'San Juan'],
85+
['AR', 'AR-D', 'San Luis'],
86+
['AR', 'AR-Z', 'Santa Cruz'],
87+
['AR', 'AR-S', 'Santa Fe'],
88+
['AR', 'AR-G', 'Santiago del Estero'],
89+
['AR', 'AR-V', 'Tierra del Fuego'],
90+
['AR', 'AR-T', 'Tucumán'],
91+
];
92+
}
93+
94+
/**
95+
* @inheritdoc
96+
*/
97+
public static function getDependencies()
98+
{
99+
return [
100+
InitializeDirectoryData::class,
101+
];
102+
}
103+
104+
/**
105+
* @inheritdoc
106+
*/
107+
public function getAliases()
108+
{
109+
return [];
110+
}
111+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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 Bolivia States
17+
*/
18+
class AddDataForBolivia implements DataPatchInterface
19+
{
20+
/**
21+
* @var ModuleDataSetupInterface
22+
*/
23+
private $moduleDataSetup;
24+
25+
/**
26+
* @var DataInstallerFactory
27+
*/
28+
private $dataInstallerFactory;
29+
30+
/**
31+
* AddDataForBolivia constructor.
32+
*
33+
* @param ModuleDataSetupInterface $moduleDataSetup
34+
* @param DataInstallerFactory $dataInstallerFactory
35+
*/
36+
public function __construct(
37+
ModuleDataSetupInterface $moduleDataSetup,
38+
DataInstallerFactory $dataInstallerFactory
39+
) {
40+
$this->moduleDataSetup = $moduleDataSetup;
41+
$this->dataInstallerFactory = $dataInstallerFactory;
42+
}
43+
44+
/**
45+
* @inheritdoc
46+
*/
47+
public function apply()
48+
{
49+
/** @var DataInstaller $dataInstaller */
50+
$dataInstaller = $this->dataInstallerFactory->create();
51+
$dataInstaller->addCountryRegions(
52+
$this->moduleDataSetup->getConnection(),
53+
$this->getDataForBolivia()
54+
);
55+
56+
return $this;
57+
}
58+
59+
/**
60+
* Bolivia states data.
61+
*
62+
* @return array
63+
*/
64+
private function getDataForBolivia()
65+
{
66+
return [
67+
['BO', 'BO-C', 'Cochabamba'],
68+
['BO', 'BO-H', 'Chuquisaca'],
69+
['BO', 'BO-B', 'El Beni'],
70+
['BO', 'BO-L', 'La Paz'],
71+
['BO', 'BO-O', 'Oruro'],
72+
['BO', 'BO-N', 'Pando'],
73+
['BO', 'BO-P', 'Potosí'],
74+
['BO', 'BO-S', 'Santa Cruz'],
75+
['BO', 'BO-T', 'Tarija'],
76+
];
77+
}
78+
79+
/**
80+
* @inheritdoc
81+
*/
82+
public static function getDependencies()
83+
{
84+
return [
85+
InitializeDirectoryData::class,
86+
];
87+
}
88+
89+
/**
90+
* @inheritdoc
91+
*/
92+
public function getAliases()
93+
{
94+
return [];
95+
}
96+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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 Chile States
17+
*/
18+
class AddDataForChile implements DataPatchInterface
19+
{
20+
/**
21+
* @var ModuleDataSetupInterface
22+
*/
23+
private $moduleDataSetup;
24+
25+
/**
26+
* @var DataInstallerFactory
27+
*/
28+
private $dataInstallerFactory;
29+
30+
/**
31+
* AddDataForChile constructor.
32+
*
33+
* @param ModuleDataSetupInterface $moduleDataSetup
34+
* @param DataInstallerFactory $dataInstallerFactory
35+
*/
36+
public function __construct(
37+
ModuleDataSetupInterface $moduleDataSetup,
38+
DataInstallerFactory $dataInstallerFactory
39+
) {
40+
$this->moduleDataSetup = $moduleDataSetup;
41+
$this->dataInstallerFactory = $dataInstallerFactory;
42+
}
43+
44+
/**
45+
* @inheritdoc
46+
*/
47+
public function apply()
48+
{
49+
/** @var DataInstaller $dataInstaller */
50+
$dataInstaller = $this->dataInstallerFactory->create();
51+
$dataInstaller->addCountryRegions(
52+
$this->moduleDataSetup->getConnection(),
53+
$this->getDataForChile()
54+
);
55+
56+
return $this;
57+
}
58+
59+
/**
60+
* Chile states data.
61+
*
62+
* @return array
63+
*/
64+
private function getDataForChile()
65+
{
66+
return [
67+
['CL', 'CL-AI', 'Aisén del General Carlos Ibañez del Campo'],
68+
['CL', 'CL-AN', 'Antofagasta'],
69+
['CL', 'CL-AP', 'Arica y Parinacota'],
70+
['CL', 'CL-AR', 'La Araucanía'],
71+
['CL', 'CL-AT', 'Atacama'],
72+
['CL', 'CL-BI', 'Biobío'],
73+
['CL', 'CL-CO', 'Coquimbo'],
74+
['CL', 'CL-LI', 'Libertador General Bernardo O\'Higgins'],
75+
['CL', 'CL-LL', 'Los Lagos'],
76+
['CL', 'CL-LR', 'Los Ríos'],
77+
['CL', 'CL-MA', 'Magallanes'],
78+
['CL', 'CL-ML', 'Maule'],
79+
['CL', 'CL-NB', 'Ñuble'],
80+
['CL', 'CL-RM', 'Región Metropolitana de Santiago'],
81+
['CL', 'CL-TA', 'Tarapacá'],
82+
['CL', 'CL-VS', 'Valparaíso'],
83+
];
84+
}
85+
86+
/**
87+
* @inheritdoc
88+
*/
89+
public static function getDependencies()
90+
{
91+
return [
92+
InitializeDirectoryData::class,
93+
];
94+
}
95+
96+
/**
97+
* @inheritdoc
98+
*/
99+
public function getAliases()
100+
{
101+
return [];
102+
}
103+
}

0 commit comments

Comments
 (0)