Skip to content

Commit

Permalink
[PIPRES-468] fixed Gytautas comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijusCoding committed Nov 20, 2024
1 parent f1ebcda commit 4a9055e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ class Config
const MOLLIE_SUBSCRIPTION_ENABLED = 'MOLLIE_SUBSCRIPTION_ENABLED';

const MOLLIE_METHOD_ENABLED = 'MOLLIE_METHOD_ENABLED_';
//todo array
const MOLLIE_METHOD_TITLE = 'MOLLIE_METHOD_TITLE_';
const MOLLIE_METHOD_API = 'MOLLIE_METHOD_API_';
const MOLLIE_METHOD_DESCRIPTION = 'MOLLIE_METHOD_DESCRIPTION_';
Expand Down
8 changes: 6 additions & 2 deletions src/Repository/MultiLangRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

use Mollie\Shared\Infrastructure\Repository\AbstractRepository;

if (!defined('PS_VERSION')) {
exit;
}

class MultiLangRepository extends AbstractRepository implements MultiLangRepositoryInterface
{
public function __construct()
Expand Down Expand Up @@ -45,14 +49,14 @@ public function getExistingRecordId(string $idPaymentMethod, int $langId, int $i
return \Db::getInstance()->getValue($sql) ?: null;
}

public function getAllTranslationsByMethod(string $idPaymentMethod, int $langId, int $idShop): array
public function getAllTranslationsByMethod(string $idPaymentMethod, int $idShop): array
{
$sql = new \DbQuery();
$sql->select('`id_lang`, `text`');
$sql->from('mol_payment_method_lang');
$sql->where('`id_method` = "' . pSQL($idPaymentMethod) . '"');
$sql->where('`id_shop` = ' . $idShop);

return \Db::getInstance()->executeS($sql);
return \Db::getInstance()->executeS($sql) ?? [];
}
}
2 changes: 1 addition & 1 deletion src/Repository/MultiLangRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ public function getExistingRecordId(string $idPaymentMethod, int $langId, int $i
* @param string $idMethod
* @return array [id_lang => text] for instance: [74 => 'Apelo Pay', 68 => 'Apella Pia']
*/
public function getAllTranslationsByMethod(string $idPaymentMethod, int $langId, int $idShop): ?array;
public function getAllTranslationsByMethod(string $idPaymentMethod, int $idShop): ?array;
}
2 changes: 1 addition & 1 deletion src/Service/PaymentMethodLangService.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function trans(string $idMethod): ?string

public function getTransList(string $idMethod): array
{
$result = $this->multiLangRepository->getAllTranslationsByMethod($idMethod, $this->context->getLanguageId(), $this->context->getShopId());
$result = $this->multiLangRepository->getAllTranslationsByMethod($idMethod, $this->context->getShopId());

$mappedArray = [];
foreach ($result as $value) {
Expand Down

0 comments on commit 4a9055e

Please sign in to comment.