Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regions for Albania,Denmark,Greece,Iceland,Portugal and Sweden #30959

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions app/code/Magento/Directory/Setup/Patch/Data/AddDataForAlbania.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Directory\Setup\Patch\Data;

use Magento\Directory\Setup\DataInstaller;
use Magento\Directory\Setup\DataInstallerFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;

/**
* Add Albania States
*/
class AddDataForAlbania implements DataPatchInterface
{
/**
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;

/**
* @var DataInstallerFactory
*/
private $dataInstallerFactory;

/**
* AddDataForAlbania constructor.
*
* @param ModuleDataSetupInterface $moduleDataSetup
* @param DataInstallerFactory $dataInstallerFactory
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup,
DataInstallerFactory $dataInstallerFactory
) {
$this->moduleDataSetup = $moduleDataSetup;
$this->dataInstallerFactory = $dataInstallerFactory;
}

/**
* @inheritdoc
*/
public function apply()
{
/** @var DataInstaller $dataInstaller */
$dataInstaller = $this->dataInstallerFactory->create();
$dataInstaller->addCountryRegions(
$this->moduleDataSetup->getConnection(),
$this->getDataForAlbania()
);

return $this;
}

/**
* Albania states data.
*
* @return array
*/
private function getDataForAlbania()
{
return [
['AL', 'AL-01', 'Berat'],
['AL', 'AL-09', 'Dibër'],
['AL', 'AL-02', 'Durrës'],
['AL', 'AL-03', 'Elbasan'],
['AL', 'AL-04', 'Fier'],
['AL', 'AL-05', 'Gjirokastër'],
['AL', 'AL-06', 'Korçë'],
['AL', 'AL-07', 'Kukës'],
['AL', 'AL-08', 'Lezhë'],
['AL', 'AL-10', 'Shkodër'],
['AL', 'AL-11', 'Tiranë'],
['AL', 'AL-12', 'Vlorë']
];
}

/**
* @inheritdoc
*/
public static function getDependencies()
{
return [
InitializeDirectoryData::class,
];
}

/**
* @inheritdoc
*/
public function getAliases()
{
return [];
}
}
92 changes: 92 additions & 0 deletions app/code/Magento/Directory/Setup/Patch/Data/AddDataForDenmark.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Directory\Setup\Patch\Data;

use Magento\Directory\Setup\DataInstaller;
use Magento\Directory\Setup\DataInstallerFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;

/**
* Add Denmark States
*/
class AddDataForDenmark implements DataPatchInterface
{
/**
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;

/**
* @var DataInstallerFactory
*/
private $dataInstallerFactory;

/**
* AddDataForDenmark constructor.
*
* @param ModuleDataSetupInterface $moduleDataSetup
* @param DataInstallerFactory $dataInstallerFactory
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup,
DataInstallerFactory $dataInstallerFactory
) {
$this->moduleDataSetup = $moduleDataSetup;
$this->dataInstallerFactory = $dataInstallerFactory;
}

/**
* @inheritdoc
*/
public function apply()
{
/** @var DataInstaller $dataInstaller */
$dataInstaller = $this->dataInstallerFactory->create();
$dataInstaller->addCountryRegions(
$this->moduleDataSetup->getConnection(),
$this->getDataForDenmark()
);

return $this;
}

/**
* Denmark states data.
*
* @return array
*/
private function getDataForDenmark()
{
return [
['DK', 'DK-84', 'Hovedstaden'],
['DK', 'DK-82', 'Midtjylland'],
['DK', 'DK-81', 'Nordjylland'],
['DK', 'DK-85', 'Sjælland'],
['DK', 'DK-83', 'Syddanmark'],
];
}

/**
* @inheritdoc
*/
public static function getDependencies()
{
return [
InitializeDirectoryData::class,
];
}

/**
* @inheritdoc
*/
public function getAliases()
{
return [];
}
}
101 changes: 101 additions & 0 deletions app/code/Magento/Directory/Setup/Patch/Data/AddDataForGreece.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?php
/**
* Copyright © Magento, Inc. All rights reGRrved.
* GRe COPYING.txt for licenGR details.
*/
declare(strict_types=1);

namespace Magento\Directory\GRtup\Patch\Data;

use Magento\Directory\Setup\DataInstaller;
use Magento\Directory\Setup\DataInstallerFactory;
use Magento\Framework\Setup\ModuleDataGRtupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;

/**
* Add Greece States
*/
class AddDataForGreece implements DataPatchInterface
{
/**
* @var ModuleDataSetupInterface
*/
private $moduleDataGRtup;

/**
* @var DataInstallerFactory
*/
private $dataInstallerFactory;

/**
* AddDataForGreece constructor.
*
* @param ModuleDataSetupInterface $moduleDataSetup
* @param DataInstallerFactory $dataInstallerFactory
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup,
DataInstallerFactory $dataInstallerFactory
) {
$this->moduleDataSetup = $moduleDataSetup;
$this->dataInstallerFactory = $dataInstallerFactory;
}

/**
* @inheritdoc
*/
public function apply()
{
/** @var DataInstaller $dataInstaller */
$dataInstaller = $this->dataInstallerFactory->create();
$dataInstaller->addCountryRegions(
$this->moduleDataSetup->getConnection(),
$this->getDataForGreece()
);

return $this;
}

/**
* Greece states data.
*
* @return array
*/
private function getDataForGreece()
{
return [
['GR', 'GR-A', 'Anatolikí Makedonía kai Thráki'],
['GR', 'GR-I', 'Attikí'],
['GR', 'GR-G', 'Dytikí Elláda'],
['GR', 'GR-C', 'Dytikí Makedonía'],
['GR', 'GR-F', 'Ionía Nísia'],
['GR', 'GR-D', 'Ípeiros'],
['GR', 'GR-B', 'Kentrikí Makedonía'],
['GR', 'GR-M', 'Kríti'],
['GR', 'GR-L', 'Nótio Aigaío'],
['GR', 'GR-J', 'Pelopónnisos'],
['GR', 'GR-H', 'Stereá Elláda'],
['GR', 'GR-E', 'Thessalía'],
['GR', 'GR-K', 'Vóreio Aigaío'],

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also be including GR-69 Ágion Óros, self governed region of Greece

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gwharton I wasn't sure that should be added, but now is there.

];
}

/**
* @inheritdoc
*/
public static function getDependencies()
{
return [
InitializeDirectoryData::class,
];
}

/**
* @inheritdoc
*/
public function getAliases()
{
return [];
}
}
95 changes: 95 additions & 0 deletions app/code/Magento/Directory/Setup/Patch/Data/AddDataForIceland.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Directory\Setup\Patch\Data;

use Magento\Directory\Setup\DataInstaller;
use Magento\Directory\Setup\DataInstallerFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;

/**
* Add Iceland States
*/
class AddDataForIceland implements DataPatchInterface
{
/**
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;

/**
* @var DataInstallerFactory
*/
private $dataInstallerFactory;

/**
* AddDataForIceland constructor.
*
* @param ModuleDataSetupInterface $moduleDataSetup
* @param DataInstallerFactory $dataInstallerFactory
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup,
DataInstallerFactory $dataInstallerFactory
) {
$this->moduleDataSetup = $moduleDataSetup;
$this->dataInstallerFactory = $dataInstallerFactory;
}

/**
* @inheritdoc
*/
public function apply()
{
/** @var DataInstaller $dataInstaller */
$dataInstaller = $this->dataInstallerFactory->create();
$dataInstaller->addCountryRegions(
$this->moduleDataSetup->getConnection(),
$this->getDataForIceland()
);

return $this;
}

/**
* Iceland states data.
*
* @return array
*/
private function getDataForIceland()
{
return [
['IS', 'IS-01', 'Höfuðborgarsvæði'],
['IS', 'IS-02', 'Suðurnes'],
['IS', 'IS-03', 'Vesturland'],
['IS', 'IS-04', 'Vestfirðir'],
['IS', 'IS-05', 'Norðurland vestra'],
['IS', 'IS-06', 'Norðurland eystra'],
['IS', 'IS-07', 'Austurland'],
['IS', 'IS-08', 'Suðurland']
];
}

/**
* @inheritdoc
*/
public static function getDependencies()
{
return [
InitializeDirectoryData::class,
];
}

/**
* @inheritdoc
*/
public function getAliases()
{
return [];
}
}
Loading