Skip to content
This repository was archived by the owner on Feb 13, 2023. It is now read-only.

Commit 2e07f0a

Browse files
authored
feature(attribute) add more currencies (#1676) (#1677)
1 parent e55a466 commit 2e07f0a

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
## CHANGELOG FOR 1.0.x
33
#### 1.0.6
4+
- feature [#1675](https://github.com/ergonode/backend/pull/1675) Add more currencies to application (rprzedzik)
45
- bugfix [#1630](https://github.com/ergonode/backend/issues/1630) Fixed handling `null` attribute value in conditions (piotrkreft)
56
- bugfix [#1617](https://github.com/ergonode/backend/issues/1617) Fixed option attribute value condition (piotrkreft)
67
- bugfix [#1613](https://github.com/ergonode/backend/issues/1613) Fixed ProductUpdatedEvent handling for segments (piotrkreft)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
/**
4+
* Copyright © Bold Brand Commerce Sp. z o.o. All rights reserved.
5+
* See LICENSE.txt for license details.
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace Ergonode\Migration;
11+
12+
use Doctrine\DBAL\Schema\Schema;
13+
use Ramsey\Uuid\Uuid;
14+
15+
final class Version20211025100000 extends AbstractErgonodeMigration
16+
{
17+
private const CURRENCIES = [
18+
'AUD' => 'Australian Dollar',
19+
'BHD' => 'Dinar',
20+
'BRL' => 'Real',
21+
'CNY' => 'Chinese Yuan',
22+
'HRK' => 'Croatian Kuna',
23+
'CZK' => 'Czech koruna',
24+
'DKK' => 'Danish krone',
25+
'JPY' => 'Japanese yen',
26+
'KHR' => 'Riel',
27+
'CAD' => 'Canadian dollar',
28+
'QAR' => 'Rial',
29+
'KZT' => 'Tenge',
30+
'KES' => 'Shilling',
31+
'CHF' => 'Swiss Franc',
32+
'MKD' => 'Denar',
33+
'MXN' => 'Pesos',
34+
'NOK' => 'Norwegian krone',
35+
'NZD' => 'New Zealand dollar',
36+
'RUB' => 'Russian ruble',
37+
'RON' => 'Romanian Leu',
38+
'SEK' => 'Swedish krona',
39+
'TRY' => 'Turkish Lira',
40+
'HUF' => 'Hungarian Forint',
41+
'AED' => 'Dirham',
42+
'UAH' => 'Ukrainian hryvnia',
43+
'KRW' => 'Won',
44+
];
45+
46+
/**
47+
* @throws \Exception
48+
*/
49+
public function up(Schema $schema): void
50+
{
51+
foreach (self::CURRENCIES as $iso => $name) {
52+
$this->addSql(
53+
'INSERT INTO currency (id, iso, name) VALUES (?, ?, ?) ON CONFLICT DO NOTHING',
54+
[Uuid::uuid4()->toString(), $iso, $name]
55+
);
56+
}
57+
}
58+
}

module/attribute/src/Infrastructure/Persistence/Query/DbalCurrencyQuery.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function __construct(Connection $connection)
3434
public function getDictionary(): array
3535
{
3636
return $this->getQuery()
37+
->orderBy('name')
3738
->execute()
3839
->fetchAll(\PDO::FETCH_KEY_PAIR);
3940
}

0 commit comments

Comments
 (0)