Skip to content

Commit

Permalink
Add regions for Albania,Denmark,Greece,Iceland,Portugal and Sweden
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolalardev committed Nov 17, 2020
1 parent 26acabe commit 0a27db2
Show file tree
Hide file tree
Showing 7 changed files with 609 additions and 1 deletion.
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'],

];
}

/**
* @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

0 comments on commit 0a27db2

Please sign in to comment.