Skip to content

Commit 0a27db2

Browse files
committed
Add regions for Albania,Denmark,Greece,Iceland,Portugal and Sweden
1 parent 26acabe commit 0a27db2

File tree

7 files changed

+609
-1
lines changed

7 files changed

+609
-1
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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 Albania States
17+
*/
18+
class AddDataForAlbania implements DataPatchInterface
19+
{
20+
/**
21+
* @var ModuleDataSetupInterface
22+
*/
23+
private $moduleDataSetup;
24+
25+
/**
26+
* @var DataInstallerFactory
27+
*/
28+
private $dataInstallerFactory;
29+
30+
/**
31+
* AddDataForAlbania 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->getDataForAlbania()
54+
);
55+
56+
return $this;
57+
}
58+
59+
/**
60+
* Albania states data.
61+
*
62+
* @return array
63+
*/
64+
private function getDataForAlbania()
65+
{
66+
return [
67+
['AL', 'AL-01', 'Berat'],
68+
['AL', 'AL-09', 'Dibër'],
69+
['AL', 'AL-02', 'Durrës'],
70+
['AL', 'AL-03', 'Elbasan'],
71+
['AL', 'AL-04', 'Fier'],
72+
['AL', 'AL-05', 'Gjirokastër'],
73+
['AL', 'AL-06', 'Korçë'],
74+
['AL', 'AL-07', 'Kukës'],
75+
['AL', 'AL-08', 'Lezhë'],
76+
['AL', 'AL-10', 'Shkodër'],
77+
['AL', 'AL-11', 'Tiranë'],
78+
['AL', 'AL-12', 'Vlorë']
79+
];
80+
}
81+
82+
/**
83+
* @inheritdoc
84+
*/
85+
public static function getDependencies()
86+
{
87+
return [
88+
InitializeDirectoryData::class,
89+
];
90+
}
91+
92+
/**
93+
* @inheritdoc
94+
*/
95+
public function getAliases()
96+
{
97+
return [];
98+
}
99+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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 Denmark States
17+
*/
18+
class AddDataForDenmark implements DataPatchInterface
19+
{
20+
/**
21+
* @var ModuleDataSetupInterface
22+
*/
23+
private $moduleDataSetup;
24+
25+
/**
26+
* @var DataInstallerFactory
27+
*/
28+
private $dataInstallerFactory;
29+
30+
/**
31+
* AddDataForDenmark 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->getDataForDenmark()
54+
);
55+
56+
return $this;
57+
}
58+
59+
/**
60+
* Denmark states data.
61+
*
62+
* @return array
63+
*/
64+
private function getDataForDenmark()
65+
{
66+
return [
67+
['DK', 'DK-84', 'Hovedstaden'],
68+
['DK', 'DK-82', 'Midtjylland'],
69+
['DK', 'DK-81', 'Nordjylland'],
70+
['DK', 'DK-85', 'Sjælland'],
71+
['DK', 'DK-83', 'Syddanmark'],
72+
];
73+
}
74+
75+
/**
76+
* @inheritdoc
77+
*/
78+
public static function getDependencies()
79+
{
80+
return [
81+
InitializeDirectoryData::class,
82+
];
83+
}
84+
85+
/**
86+
* @inheritdoc
87+
*/
88+
public function getAliases()
89+
{
90+
return [];
91+
}
92+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reGRrved.
4+
* GRe COPYING.txt for licenGR details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Directory\GRtup\Patch\Data;
9+
10+
use Magento\Directory\Setup\DataInstaller;
11+
use Magento\Directory\Setup\DataInstallerFactory;
12+
use Magento\Framework\Setup\ModuleDataGRtupInterface;
13+
use Magento\Framework\Setup\Patch\DataPatchInterface;
14+
15+
/**
16+
* Add Greece States
17+
*/
18+
class AddDataForGreece implements DataPatchInterface
19+
{
20+
/**
21+
* @var ModuleDataSetupInterface
22+
*/
23+
private $moduleDataGRtup;
24+
25+
/**
26+
* @var DataInstallerFactory
27+
*/
28+
private $dataInstallerFactory;
29+
30+
/**
31+
* AddDataForGreece 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->getDataForGreece()
54+
);
55+
56+
return $this;
57+
}
58+
59+
/**
60+
* Greece states data.
61+
*
62+
* @return array
63+
*/
64+
private function getDataForGreece()
65+
{
66+
return [
67+
['GR', 'GR-A', 'Anatolikí Makedonía kai Thráki'],
68+
['GR', 'GR-I', 'Attikí'],
69+
['GR', 'GR-G', 'Dytikí Elláda'],
70+
['GR', 'GR-C', 'Dytikí Makedonía'],
71+
['GR', 'GR-F', 'Ionía Nísia'],
72+
['GR', 'GR-D', 'Ípeiros'],
73+
['GR', 'GR-B', 'Kentrikí Makedonía'],
74+
['GR', 'GR-M', 'Kríti'],
75+
['GR', 'GR-L', 'Nótio Aigaío'],
76+
['GR', 'GR-J', 'Pelopónnisos'],
77+
['GR', 'GR-H', 'Stereá Elláda'],
78+
['GR', 'GR-E', 'Thessalía'],
79+
['GR', 'GR-K', 'Vóreio Aigaío'],
80+
81+
];
82+
}
83+
84+
/**
85+
* @inheritdoc
86+
*/
87+
public static function getDependencies()
88+
{
89+
return [
90+
InitializeDirectoryData::class,
91+
];
92+
}
93+
94+
/**
95+
* @inheritdoc
96+
*/
97+
public function getAliases()
98+
{
99+
return [];
100+
}
101+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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 Iceland States
17+
*/
18+
class AddDataForIceland implements DataPatchInterface
19+
{
20+
/**
21+
* @var ModuleDataSetupInterface
22+
*/
23+
private $moduleDataSetup;
24+
25+
/**
26+
* @var DataInstallerFactory
27+
*/
28+
private $dataInstallerFactory;
29+
30+
/**
31+
* AddDataForIceland 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->getDataForIceland()
54+
);
55+
56+
return $this;
57+
}
58+
59+
/**
60+
* Iceland states data.
61+
*
62+
* @return array
63+
*/
64+
private function getDataForIceland()
65+
{
66+
return [
67+
['IS', 'IS-01', 'Höfuðborgarsvæði'],
68+
['IS', 'IS-02', 'Suðurnes'],
69+
['IS', 'IS-03', 'Vesturland'],
70+
['IS', 'IS-04', 'Vestfirðir'],
71+
['IS', 'IS-05', 'Norðurland vestra'],
72+
['IS', 'IS-06', 'Norðurland eystra'],
73+
['IS', 'IS-07', 'Austurland'],
74+
['IS', 'IS-08', 'Suðurland']
75+
];
76+
}
77+
78+
/**
79+
* @inheritdoc
80+
*/
81+
public static function getDependencies()
82+
{
83+
return [
84+
InitializeDirectoryData::class,
85+
];
86+
}
87+
88+
/**
89+
* @inheritdoc
90+
*/
91+
public function getAliases()
92+
{
93+
return [];
94+
}
95+
}

0 commit comments

Comments
 (0)