Release 0.255: migrate remaining Languages usages to repository DI

This commit is contained in:
2026-02-12 22:28:57 +01:00
parent 95c5fda989
commit 58a41691e6
25 changed files with 95 additions and 44 deletions

View File

@@ -1,4 +1,4 @@
<?
<?php
namespace admin\factory;
class Languages
@@ -49,5 +49,3 @@ class Languages
return self::repository()->languagesList((bool)$only_active);
}
}
?>

View File

@@ -62,7 +62,7 @@ class ShopAttribute
\admin\factory\ShopProduct::update_product_price_by_attribute_value_impact( $ids[$main_language][$i], $impact_on_the_price[$i] );
$langs = \admin\factory\Languages::languages_list();
$langs = ( new \Domain\Languages\LanguagesRepository( $mdb ) )->languagesList();
foreach ( $langs as $lang )
{
@@ -108,7 +108,7 @@ class ShopAttribute
if ( $impact_on_the_price[$i] )
\admin\factory\ShopProduct::update_product_price_by_attribute_value_impact( $value_id, \S::normalize_decimal( $impact_on_the_price[$i] ) );
$langs = \admin\factory\Languages::languages_list();
$langs = ( new \Domain\Languages\LanguagesRepository( $mdb ) )->languagesList();
if ( \S::is_array_fix( $langs ) ) foreach ( $langs as $lang )
{
if ( $names[$lang['id']][$i] )

View File

@@ -28,7 +28,7 @@ class ShopProducer
$id = $mdb -> id();
$langs = \admin\factory\Languages::languages_list( true );
$langs = ( new \Domain\Languages\LanguagesRepository( $mdb ) )->languagesList( true );
foreach ( $langs as $lg )
{
$mdb -> insert( 'pp_shop_producer_lang', [
@@ -55,7 +55,7 @@ class ShopProducer
'id' => (int) $producer_id
] );
$langs = \admin\factory\Languages::languages_list( true );
$langs = ( new \Domain\Languages\LanguagesRepository( $mdb ) )->languagesList( true );
foreach ( $langs as $lg )
{
if ( $translation_id = $mdb -> get( 'pp_shop_producer_lang', 'id', [ 'AND' => [ 'producer_id' => $producer_id, 'lang_id' => $lg['id'] ] ] ) )
@@ -86,4 +86,4 @@ class ShopProducer
}
return false;
}
}
}

View File

@@ -802,7 +802,7 @@ class ShopProduct
if ( $id )
{
$langs = \admin\factory\Languages::languages_list( true );
$langs = ( new \Domain\Languages\LanguagesRepository( $mdb ) )->languagesList( true );
foreach ( $langs as $lg )
{
$mdb -> insert( 'pp_shop_products_langs', [
@@ -1009,7 +1009,7 @@ class ShopProduct
\admin\factory\ShopProduct::update_product_combinations_prices( $product_id, $price_brutto, $vat, $price_brutto_promo );
$langs = \admin\factory\Languages::languages_list( true );
$langs = ( new \Domain\Languages\LanguagesRepository( $mdb ) )->languagesList( true );
foreach ( $langs as $lg )
{
if ( $translation_id = $mdb -> get( 'pp_shop_products_langs', 'id', [ 'AND' => [ 'product_id' => $product_id, 'lang_id' => $lg['id'] ] ] ) )