Release 0.255: migrate remaining Languages usages to repository DI
This commit is contained in:
@@ -402,3 +402,10 @@ Aktualnie w suite są też testy modułów `Dictionaries`, `Articles` i `Users`
|
|||||||
- Modul `/admin/languages/` (jezyki + tlumaczenia) dziala na nowym routingu DI.
|
- Modul `/admin/languages/` (jezyki + tlumaczenia) dziala na nowym routingu DI.
|
||||||
- Widoki jezykow przepiete na `components/table-list` i `components/form-edit`.
|
- Widoki jezykow przepiete na `components/table-list` i `components/form-edit`.
|
||||||
- Usunieto legacy: `autoload/admin/controls/class.Languages.php`, `autoload/admin/view/class.Languages.php`.
|
- Usunieto legacy: `autoload/admin/controls/class.Languages.php`, `autoload/admin/view/class.Languages.php`.
|
||||||
|
|
||||||
|
## Aktualizacja 2026-02-12 (ver. 0.255)
|
||||||
|
- UPDATE: admin/Controllers/SettingsController, BannerController, DictionariesController, ArticlesController pobieraja listy jezykow przez Domain/Languages/LanguagesRepository (DI), bez zaleznosci od admin/factory/Languages.
|
||||||
|
- UPDATE: w admin/Site fabryki DI dla Articles, Banners, Settings, Dictionaries przekazuja rowniez LanguagesRepository.
|
||||||
|
- UPDATE: legacy admin/controls/* oraz admin/factory/Shop* przepiete z admin/factory/Languages::languages_list() na bezposrednie wywolania LanguagesRepository.
|
||||||
|
- FIX: autoload/admin/factory/class.Languages.php uzywa pelnego znacznika <?php (kompatybilnosc serwerow z short_open_tag=Off).
|
||||||
|
- Testy: 130 tests, 303 assertions
|
||||||
@@ -590,3 +590,10 @@ Gdy `persist = true`:
|
|||||||
- **UPDATE:** `admin\\factory\\Languages` jako fasada delegujaca do repozytorium
|
- **UPDATE:** `admin\\factory\\Languages` jako fasada delegujaca do repozytorium
|
||||||
- **CLEANUP:** usunieto legacy `admin\\controls\\Languages` oraz `admin\\view\\Languages`
|
- **CLEANUP:** usunieto legacy `admin\\controls\\Languages` oraz `admin\\view\\Languages`
|
||||||
- **UPDATE:** poprawki globalne `components/table-list` dla krotkich kolumn/filtr<74>w
|
- **UPDATE:** poprawki globalne `components/table-list` dla krotkich kolumn/filtr<74>w
|
||||||
|
|
||||||
|
## Aktualizacja 2026-02-12 (ver. 0.255)
|
||||||
|
- UPDATE: SettingsController, BannerController, DictionariesController, ArticlesController pobieraja liste jezykow przez Domain/Languages/LanguagesRepository (DI) zamiast legacy admin/factory/Languages.
|
||||||
|
- UPDATE: router DI (admin/Site) przekazuje LanguagesRepository do kontrolerow Articles, Banners, Settings, Dictionaries.
|
||||||
|
- UPDATE: pozostale aktywne odwolania legacy (admin/controls, admin/factory/Shop*) zostaly przepiete na LanguagesRepository.
|
||||||
|
- FIX: autoload/admin/factory/class.Languages.php poprawione na <?php (zgodnosc z short_open_tag=Off).
|
||||||
|
- Testy po zmianie: 130 tests, 303 assertions.
|
||||||
@@ -184,3 +184,10 @@ OK (130 tests, 301 assertions)
|
|||||||
Nowe testy dodane 2026-02-12:
|
Nowe testy dodane 2026-02-12:
|
||||||
- `tests/Unit/Domain/Languages/LanguagesRepositoryTest.php`
|
- `tests/Unit/Domain/Languages/LanguagesRepositoryTest.php`
|
||||||
- `tests/Unit/admin/Controllers/LanguagesControllerTest.php`
|
- `tests/Unit/admin/Controllers/LanguagesControllerTest.php`
|
||||||
|
|
||||||
|
## Aktualizacja suite (release 0.255)
|
||||||
|
Ostatnio zweryfikowano: 2026-02-12
|
||||||
|
|
||||||
|
```text
|
||||||
|
OK (130 tests, 303 assertions)
|
||||||
|
```
|
||||||
|
|||||||
@@ -2,14 +2,17 @@
|
|||||||
namespace admin\Controllers;
|
namespace admin\Controllers;
|
||||||
|
|
||||||
use Domain\Article\ArticleRepository;
|
use Domain\Article\ArticleRepository;
|
||||||
|
use Domain\Languages\LanguagesRepository;
|
||||||
|
|
||||||
class ArticlesController
|
class ArticlesController
|
||||||
{
|
{
|
||||||
private ArticleRepository $repository;
|
private ArticleRepository $repository;
|
||||||
|
private LanguagesRepository $languagesRepository;
|
||||||
|
|
||||||
public function __construct(ArticleRepository $repository)
|
public function __construct(ArticleRepository $repository, LanguagesRepository $languagesRepository)
|
||||||
{
|
{
|
||||||
$this->repository = $repository;
|
$this->repository = $repository;
|
||||||
|
$this->languagesRepository = $languagesRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -185,7 +188,7 @@ class ArticlesController
|
|||||||
return \Tpl::view('articles/article-edit', [
|
return \Tpl::view('articles/article-edit', [
|
||||||
'article' => $this->repository->find((int)\S::get('id')),
|
'article' => $this->repository->find((int)\S::get('id')),
|
||||||
'menus' => \admin\factory\Pages::menus_list(),
|
'menus' => \admin\factory\Pages::menus_list(),
|
||||||
'languages' => \admin\factory\Languages::languages_list(),
|
'languages' => $this->languagesRepository->languagesList(),
|
||||||
'layouts' => \admin\factory\Layouts::layouts_list(),
|
'layouts' => \admin\factory\Layouts::layouts_list(),
|
||||||
'user' => $user
|
'user' => $user
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
namespace admin\Controllers;
|
namespace admin\Controllers;
|
||||||
|
|
||||||
use Domain\Banner\BannerRepository;
|
use Domain\Banner\BannerRepository;
|
||||||
|
use Domain\Languages\LanguagesRepository;
|
||||||
use admin\ViewModels\Forms\FormEditViewModel;
|
use admin\ViewModels\Forms\FormEditViewModel;
|
||||||
use admin\ViewModels\Forms\FormField;
|
use admin\ViewModels\Forms\FormField;
|
||||||
use admin\ViewModels\Forms\FormTab;
|
use admin\ViewModels\Forms\FormTab;
|
||||||
@@ -11,11 +12,13 @@ use admin\Support\Forms\FormRequestHandler;
|
|||||||
class BannerController
|
class BannerController
|
||||||
{
|
{
|
||||||
private BannerRepository $repository;
|
private BannerRepository $repository;
|
||||||
|
private LanguagesRepository $languagesRepository;
|
||||||
private FormRequestHandler $formHandler;
|
private FormRequestHandler $formHandler;
|
||||||
|
|
||||||
public function __construct(BannerRepository $repository)
|
public function __construct(BannerRepository $repository, LanguagesRepository $languagesRepository)
|
||||||
{
|
{
|
||||||
$this->repository = $repository;
|
$this->repository = $repository;
|
||||||
|
$this->languagesRepository = $languagesRepository;
|
||||||
$this->formHandler = new FormRequestHandler();
|
$this->formHandler = new FormRequestHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +166,7 @@ class BannerController
|
|||||||
{
|
{
|
||||||
$bannerId = (int)\S::get('id');
|
$bannerId = (int)\S::get('id');
|
||||||
$banner = $this->repository->find($bannerId);
|
$banner = $this->repository->find($bannerId);
|
||||||
$languages = \admin\factory\Languages::languages_list();
|
$languages = $this->languagesRepository->languagesList();
|
||||||
|
|
||||||
// Sprawdź czy są błędy walidacji z poprzedniego requestu
|
// Sprawdź czy są błędy walidacji z poprzedniego requestu
|
||||||
$validationErrors = $_SESSION['form_errors'][$this->getFormId()] ?? null;
|
$validationErrors = $_SESSION['form_errors'][$this->getFormId()] ?? null;
|
||||||
@@ -185,7 +188,7 @@ class BannerController
|
|||||||
|
|
||||||
$bannerId = (int)\S::get('id');
|
$bannerId = (int)\S::get('id');
|
||||||
$banner = $this->repository->find($bannerId);
|
$banner = $this->repository->find($bannerId);
|
||||||
$languages = \admin\factory\Languages::languages_list();
|
$languages = $this->languagesRepository->languagesList();
|
||||||
|
|
||||||
$viewModel = $this->buildFormViewModel($banner, $languages);
|
$viewModel = $this->buildFormViewModel($banner, $languages);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
namespace admin\Controllers;
|
namespace admin\Controllers;
|
||||||
|
|
||||||
use Domain\Dictionaries\DictionariesRepository;
|
use Domain\Dictionaries\DictionariesRepository;
|
||||||
|
use Domain\Languages\LanguagesRepository;
|
||||||
use admin\ViewModels\Forms\FormAction;
|
use admin\ViewModels\Forms\FormAction;
|
||||||
use admin\ViewModels\Forms\FormEditViewModel;
|
use admin\ViewModels\Forms\FormEditViewModel;
|
||||||
use admin\ViewModels\Forms\FormField;
|
use admin\ViewModels\Forms\FormField;
|
||||||
@@ -11,11 +12,13 @@ use admin\Support\Forms\FormRequestHandler;
|
|||||||
class DictionariesController
|
class DictionariesController
|
||||||
{
|
{
|
||||||
private DictionariesRepository $repository;
|
private DictionariesRepository $repository;
|
||||||
|
private LanguagesRepository $languagesRepository;
|
||||||
private FormRequestHandler $formHandler;
|
private FormRequestHandler $formHandler;
|
||||||
|
|
||||||
public function __construct(DictionariesRepository $repository)
|
public function __construct(DictionariesRepository $repository, LanguagesRepository $languagesRepository)
|
||||||
{
|
{
|
||||||
$this->repository = $repository;
|
$this->repository = $repository;
|
||||||
|
$this->languagesRepository = $languagesRepository;
|
||||||
$this->formHandler = new FormRequestHandler();
|
$this->formHandler = new FormRequestHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +120,7 @@ class DictionariesController
|
|||||||
{
|
{
|
||||||
$unitId = (int)\S::get('id');
|
$unitId = (int)\S::get('id');
|
||||||
$unit = $this->repository->find($unitId) ?? ['id' => 0, 'languages' => []];
|
$unit = $this->repository->find($unitId) ?? ['id' => 0, 'languages' => []];
|
||||||
$languages = \admin\factory\Languages::languages_list();
|
$languages = $this->languagesRepository->languagesList();
|
||||||
|
|
||||||
$validationErrors = $_SESSION['form_errors'][$this->getFormId()] ?? null;
|
$validationErrors = $_SESSION['form_errors'][$this->getFormId()] ?? null;
|
||||||
if ($validationErrors) {
|
if ($validationErrors) {
|
||||||
@@ -152,7 +155,7 @@ class DictionariesController
|
|||||||
|
|
||||||
$unitId = (int)\S::get('id');
|
$unitId = (int)\S::get('id');
|
||||||
$unit = $this->repository->find($unitId) ?? ['id' => 0, 'languages' => []];
|
$unit = $this->repository->find($unitId) ?? ['id' => 0, 'languages' => []];
|
||||||
$languages = \admin\factory\Languages::languages_list();
|
$languages = $this->languagesRepository->languagesList();
|
||||||
$viewModel = $this->buildFormViewModel($unit, $languages);
|
$viewModel = $this->buildFormViewModel($unit, $languages);
|
||||||
|
|
||||||
$result = $this->formHandler->handleSubmit($viewModel, $_POST);
|
$result = $this->formHandler->handleSubmit($viewModel, $_POST);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace admin\Controllers;
|
namespace admin\Controllers;
|
||||||
|
|
||||||
|
use Domain\Languages\LanguagesRepository;
|
||||||
use Domain\Settings\SettingsRepository;
|
use Domain\Settings\SettingsRepository;
|
||||||
use admin\ViewModels\Forms\FormEditViewModel;
|
use admin\ViewModels\Forms\FormEditViewModel;
|
||||||
use admin\ViewModels\Forms\FormField;
|
use admin\ViewModels\Forms\FormField;
|
||||||
@@ -14,11 +15,13 @@ use admin\Support\Forms\FormRequestHandler;
|
|||||||
class SettingsController
|
class SettingsController
|
||||||
{
|
{
|
||||||
private SettingsRepository $settingsRepository;
|
private SettingsRepository $settingsRepository;
|
||||||
|
private LanguagesRepository $languagesRepository;
|
||||||
private FormRequestHandler $formHandler;
|
private FormRequestHandler $formHandler;
|
||||||
|
|
||||||
public function __construct(SettingsRepository $settingsRepository)
|
public function __construct(SettingsRepository $settingsRepository, LanguagesRepository $languagesRepository)
|
||||||
{
|
{
|
||||||
$this->settingsRepository = $settingsRepository;
|
$this->settingsRepository = $settingsRepository;
|
||||||
|
$this->languagesRepository = $languagesRepository;
|
||||||
$this->formHandler = new FormRequestHandler();
|
$this->formHandler = new FormRequestHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +86,7 @@ class SettingsController
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$languages = \admin\factory\Languages::languages_list();
|
$languages = $this->languagesRepository->languagesList();
|
||||||
$settings = $this->settingsRepository->getSettings();
|
$settings = $this->settingsRepository->getSettings();
|
||||||
$viewModel = $this->buildFormViewModel($settings, $languages);
|
$viewModel = $this->buildFormViewModel($settings, $languages);
|
||||||
|
|
||||||
@@ -113,7 +116,7 @@ class SettingsController
|
|||||||
*/
|
*/
|
||||||
public function view(): string
|
public function view(): string
|
||||||
{
|
{
|
||||||
$languages = \admin\factory\Languages::languages_list();
|
$languages = $this->languagesRepository->languagesList();
|
||||||
$settings = $this->settingsRepository->getSettings();
|
$settings = $this->settingsRepository->getSettings();
|
||||||
|
|
||||||
$validationErrors = $_SESSION['form_errors'][$this->getFormId()] ?? null;
|
$validationErrors = $_SESSION['form_errors'][$this->getFormId()] ?? null;
|
||||||
|
|||||||
@@ -206,21 +206,24 @@ class Site
|
|||||||
global $mdb;
|
global $mdb;
|
||||||
|
|
||||||
return new \admin\Controllers\ArticlesController(
|
return new \admin\Controllers\ArticlesController(
|
||||||
new \Domain\Article\ArticleRepository( $mdb )
|
new \Domain\Article\ArticleRepository( $mdb ),
|
||||||
|
new \Domain\Languages\LanguagesRepository( $mdb )
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
'Banners' => function() {
|
'Banners' => function() {
|
||||||
global $mdb;
|
global $mdb;
|
||||||
|
|
||||||
return new \admin\Controllers\BannerController(
|
return new \admin\Controllers\BannerController(
|
||||||
new \Domain\Banner\BannerRepository( $mdb )
|
new \Domain\Banner\BannerRepository( $mdb ),
|
||||||
|
new \Domain\Languages\LanguagesRepository( $mdb )
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
'Settings' => function() {
|
'Settings' => function() {
|
||||||
global $mdb;
|
global $mdb;
|
||||||
|
|
||||||
return new \admin\Controllers\SettingsController(
|
return new \admin\Controllers\SettingsController(
|
||||||
new \Domain\Settings\SettingsRepository( $mdb )
|
new \Domain\Settings\SettingsRepository( $mdb ),
|
||||||
|
new \Domain\Languages\LanguagesRepository( $mdb )
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
'ProductArchive' => function() {
|
'ProductArchive' => function() {
|
||||||
@@ -242,7 +245,8 @@ class Site
|
|||||||
global $mdb;
|
global $mdb;
|
||||||
|
|
||||||
return new \admin\Controllers\DictionariesController(
|
return new \admin\Controllers\DictionariesController(
|
||||||
new \Domain\Dictionaries\DictionariesRepository( $mdb )
|
new \Domain\Dictionaries\DictionariesRepository( $mdb ),
|
||||||
|
new \Domain\Languages\LanguagesRepository( $mdb )
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
'Filemanager' => function() {
|
'Filemanager' => function() {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class Pages
|
|||||||
'menu_id' => \S::get( 'menu_id' ),
|
'menu_id' => \S::get( 'menu_id' ),
|
||||||
'menus' => \admin\factory\Pages::menu_lists(),
|
'menus' => \admin\factory\Pages::menu_lists(),
|
||||||
'layouts' => \admin\factory\Layouts::layouts_list(),
|
'layouts' => \admin\factory\Layouts::layouts_list(),
|
||||||
'languages' => \admin\factory\Languages::languages_list()
|
'languages' => ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->languagesList()
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class Scontainers
|
|||||||
\admin\factory\Scontainers::container_details(
|
\admin\factory\Scontainers::container_details(
|
||||||
\S::get( 'id' )
|
\S::get( 'id' )
|
||||||
),
|
),
|
||||||
\admin\factory\Languages::languages_list()
|
( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->languagesList()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class ShopAttribute
|
|||||||
return \Tpl::view( 'shop-attribute/values-edit', [
|
return \Tpl::view( 'shop-attribute/values-edit', [
|
||||||
'attribute' => \admin\factory\ShopAttribute::attribute_details( (int) \S::get( 'attribute-id' ) ),
|
'attribute' => \admin\factory\ShopAttribute::attribute_details( (int) \S::get( 'attribute-id' ) ),
|
||||||
'values' => \admin\factory\ShopAttribute::get_attribute_values( (int) \S::get( 'attribute-id' ) ),
|
'values' => \admin\factory\ShopAttribute::get_attribute_values( (int) \S::get( 'attribute-id' ) ),
|
||||||
'languages' => \admin\factory\Languages::languages_list()
|
'languages' => ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->languagesList()
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ class ShopAttribute
|
|||||||
{
|
{
|
||||||
return \Tpl::view( 'shop-attribute/attribute-edit', [
|
return \Tpl::view( 'shop-attribute/attribute-edit', [
|
||||||
'attribute' => \admin\factory\ShopAttribute::attribute_details( (int) \S::get( 'id' ) ),
|
'attribute' => \admin\factory\ShopAttribute::attribute_details( (int) \S::get( 'id' ) ),
|
||||||
'languages' => \admin\factory\Languages::languages_list()
|
'languages' => ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->languagesList()
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class ShopCategory
|
|||||||
\S::get( 'id' )
|
\S::get( 'id' )
|
||||||
),
|
),
|
||||||
\S::get( 'pid' ),
|
\S::get( 'pid' ),
|
||||||
\admin\factory\Languages::languages_list()
|
( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->languagesList()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,4 +63,4 @@ class ShopCategory
|
|||||||
'dlang' => \front\factory\Languages::default_language()
|
'dlang' => \front\factory\Languages::default_language()
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class ShopProducer
|
|||||||
{
|
{
|
||||||
return \Tpl::view( 'shop-producer/edit', [
|
return \Tpl::view( 'shop-producer/edit', [
|
||||||
'producer' => \S::get( 'id' ) ? new \shop\Producer( \S::get( 'id' ) ) : null,
|
'producer' => \S::get( 'id' ) ? new \shop\Producer( \S::get( 'id' ) ) : null,
|
||||||
'languages' => \admin\factory\Languages::languages_list()
|
'languages' => ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->languagesList()
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,4 +34,4 @@ class ShopProducer
|
|||||||
{
|
{
|
||||||
return \Tpl::view( 'shop-producer/list' );
|
return \Tpl::view( 'shop-producer/list' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ class ShopProduct
|
|||||||
|
|
||||||
return \Tpl::view( 'shop-product/product-edit', [
|
return \Tpl::view( 'shop-product/product-edit', [
|
||||||
'product' => \admin\factory\ShopProduct::product_details( (int) \S::get( 'id' ) ),
|
'product' => \admin\factory\ShopProduct::product_details( (int) \S::get( 'id' ) ),
|
||||||
'languages' => \admin\factory\Languages::languages_list(),
|
'languages' => ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->languagesList(),
|
||||||
'categories' => \admin\factory\ShopCategory::subcategories( null ),
|
'categories' => \admin\factory\ShopCategory::subcategories( null ),
|
||||||
'layouts' => \admin\factory\Layouts::layouts_list(),
|
'layouts' => \admin\factory\Layouts::layouts_list(),
|
||||||
'products' => \admin\factory\ShopProduct::products_list(),
|
'products' => \admin\factory\ShopProduct::products_list(),
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?
|
<?php
|
||||||
namespace admin\factory;
|
namespace admin\factory;
|
||||||
|
|
||||||
class Languages
|
class Languages
|
||||||
@@ -49,5 +49,3 @@ class Languages
|
|||||||
return self::repository()->languagesList((bool)$only_active);
|
return self::repository()->languagesList((bool)$only_active);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
|
|||||||
@@ -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] );
|
\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 )
|
foreach ( $langs as $lang )
|
||||||
{
|
{
|
||||||
@@ -108,7 +108,7 @@ class ShopAttribute
|
|||||||
if ( $impact_on_the_price[$i] )
|
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] ) );
|
\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 ( \S::is_array_fix( $langs ) ) foreach ( $langs as $lang )
|
||||||
{
|
{
|
||||||
if ( $names[$lang['id']][$i] )
|
if ( $names[$lang['id']][$i] )
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class ShopProducer
|
|||||||
|
|
||||||
$id = $mdb -> id();
|
$id = $mdb -> id();
|
||||||
|
|
||||||
$langs = \admin\factory\Languages::languages_list( true );
|
$langs = ( new \Domain\Languages\LanguagesRepository( $mdb ) )->languagesList( true );
|
||||||
foreach ( $langs as $lg )
|
foreach ( $langs as $lg )
|
||||||
{
|
{
|
||||||
$mdb -> insert( 'pp_shop_producer_lang', [
|
$mdb -> insert( 'pp_shop_producer_lang', [
|
||||||
@@ -55,7 +55,7 @@ class ShopProducer
|
|||||||
'id' => (int) $producer_id
|
'id' => (int) $producer_id
|
||||||
] );
|
] );
|
||||||
|
|
||||||
$langs = \admin\factory\Languages::languages_list( true );
|
$langs = ( new \Domain\Languages\LanguagesRepository( $mdb ) )->languagesList( true );
|
||||||
foreach ( $langs as $lg )
|
foreach ( $langs as $lg )
|
||||||
{
|
{
|
||||||
if ( $translation_id = $mdb -> get( 'pp_shop_producer_lang', 'id', [ 'AND' => [ 'producer_id' => $producer_id, 'lang_id' => $lg['id'] ] ] ) )
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -802,7 +802,7 @@ class ShopProduct
|
|||||||
|
|
||||||
if ( $id )
|
if ( $id )
|
||||||
{
|
{
|
||||||
$langs = \admin\factory\Languages::languages_list( true );
|
$langs = ( new \Domain\Languages\LanguagesRepository( $mdb ) )->languagesList( true );
|
||||||
foreach ( $langs as $lg )
|
foreach ( $langs as $lg )
|
||||||
{
|
{
|
||||||
$mdb -> insert( 'pp_shop_products_langs', [
|
$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 );
|
\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 )
|
foreach ( $langs as $lg )
|
||||||
{
|
{
|
||||||
if ( $translation_id = $mdb -> get( 'pp_shop_products_langs', 'id', [ 'AND' => [ 'product_id' => $product_id, 'lang_id' => $lg['id'] ] ] ) )
|
if ( $translation_id = $mdb -> get( 'pp_shop_products_langs', 'id', [ 'AND' => [ 'product_id' => $product_id, 'lang_id' => $lg['id'] ] ] ) )
|
||||||
|
|||||||
@@ -4,16 +4,19 @@ namespace Tests\Unit\admin\Controllers;
|
|||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use admin\Controllers\ArticlesController;
|
use admin\Controllers\ArticlesController;
|
||||||
use Domain\Article\ArticleRepository;
|
use Domain\Article\ArticleRepository;
|
||||||
|
use Domain\Languages\LanguagesRepository;
|
||||||
|
|
||||||
class ArticlesControllerTest extends TestCase
|
class ArticlesControllerTest extends TestCase
|
||||||
{
|
{
|
||||||
private $mockRepository;
|
private $mockRepository;
|
||||||
|
private $mockLanguagesRepository;
|
||||||
private $controller;
|
private $controller;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->mockRepository = $this->createMock(ArticleRepository::class);
|
$this->mockRepository = $this->createMock(ArticleRepository::class);
|
||||||
$this->controller = new ArticlesController($this->mockRepository);
|
$this->mockLanguagesRepository = $this->createMock(LanguagesRepository::class);
|
||||||
|
$this->controller = new ArticlesController($this->mockRepository, $this->mockLanguagesRepository);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCanCreateController(): void
|
public function testCanCreateController(): void
|
||||||
@@ -23,7 +26,7 @@ class ArticlesControllerTest extends TestCase
|
|||||||
|
|
||||||
public function testConstructorAcceptsRepository(): void
|
public function testConstructorAcceptsRepository(): void
|
||||||
{
|
{
|
||||||
$controller = new ArticlesController($this->mockRepository);
|
$controller = new ArticlesController($this->mockRepository, $this->mockLanguagesRepository);
|
||||||
$this->assertInstanceOf(ArticlesController::class, $controller);
|
$this->assertInstanceOf(ArticlesController::class, $controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +69,8 @@ class ArticlesControllerTest extends TestCase
|
|||||||
$constructor = $reflection->getConstructor();
|
$constructor = $reflection->getConstructor();
|
||||||
$params = $constructor->getParameters();
|
$params = $constructor->getParameters();
|
||||||
|
|
||||||
$this->assertCount(1, $params);
|
$this->assertCount(2, $params);
|
||||||
$this->assertEquals('Domain\Article\ArticleRepository', $params[0]->getType()->getName());
|
$this->assertEquals('Domain\Article\ArticleRepository', $params[0]->getType()->getName());
|
||||||
|
$this->assertEquals('Domain\Languages\LanguagesRepository', $params[1]->getType()->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,21 +4,24 @@ namespace Tests\Unit\admin\Controllers;
|
|||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use admin\Controllers\DictionariesController;
|
use admin\Controllers\DictionariesController;
|
||||||
use Domain\Dictionaries\DictionariesRepository;
|
use Domain\Dictionaries\DictionariesRepository;
|
||||||
|
use Domain\Languages\LanguagesRepository;
|
||||||
|
|
||||||
class DictionariesControllerTest extends TestCase
|
class DictionariesControllerTest extends TestCase
|
||||||
{
|
{
|
||||||
private $mockRepository;
|
private $mockRepository;
|
||||||
|
private $mockLanguagesRepository;
|
||||||
private $controller;
|
private $controller;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->mockRepository = $this->createMock(DictionariesRepository::class);
|
$this->mockRepository = $this->createMock(DictionariesRepository::class);
|
||||||
$this->controller = new DictionariesController($this->mockRepository);
|
$this->mockLanguagesRepository = $this->createMock(LanguagesRepository::class);
|
||||||
|
$this->controller = new DictionariesController($this->mockRepository, $this->mockLanguagesRepository);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testConstructorAcceptsRepository(): void
|
public function testConstructorAcceptsRepository(): void
|
||||||
{
|
{
|
||||||
$controller = new DictionariesController($this->mockRepository);
|
$controller = new DictionariesController($this->mockRepository, $this->mockLanguagesRepository);
|
||||||
$this->assertInstanceOf(DictionariesController::class, $controller);
|
$this->assertInstanceOf(DictionariesController::class, $controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +61,8 @@ class DictionariesControllerTest extends TestCase
|
|||||||
$constructor = $reflection->getConstructor();
|
$constructor = $reflection->getConstructor();
|
||||||
$params = $constructor->getParameters();
|
$params = $constructor->getParameters();
|
||||||
|
|
||||||
$this->assertCount(1, $params);
|
$this->assertCount(2, $params);
|
||||||
$this->assertEquals('Domain\Dictionaries\DictionariesRepository', $params[0]->getType()->getName());
|
$this->assertEquals('Domain\Dictionaries\DictionariesRepository', $params[0]->getType()->getName());
|
||||||
|
$this->assertEquals('Domain\Languages\LanguagesRepository', $params[1]->getType()->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ namespace Tests\Unit\admin\Controllers;
|
|||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use admin\Controllers\SettingsController;
|
use admin\Controllers\SettingsController;
|
||||||
|
use Domain\Languages\LanguagesRepository;
|
||||||
use Domain\Settings\SettingsRepository;
|
use Domain\Settings\SettingsRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,17 +15,19 @@ use Domain\Settings\SettingsRepository;
|
|||||||
class SettingsControllerTest extends TestCase
|
class SettingsControllerTest extends TestCase
|
||||||
{
|
{
|
||||||
private $mockSettingsRepository;
|
private $mockSettingsRepository;
|
||||||
|
private $mockLanguagesRepository;
|
||||||
private $controller;
|
private $controller;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->mockSettingsRepository = $this->createMock(SettingsRepository::class);
|
$this->mockSettingsRepository = $this->createMock(SettingsRepository::class);
|
||||||
$this->controller = new SettingsController($this->mockSettingsRepository);
|
$this->mockLanguagesRepository = $this->createMock(LanguagesRepository::class);
|
||||||
|
$this->controller = new SettingsController($this->mockSettingsRepository, $this->mockLanguagesRepository);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testConstructorAcceptsRepository(): void
|
public function testConstructorAcceptsRepository(): void
|
||||||
{
|
{
|
||||||
$controller = new SettingsController($this->mockSettingsRepository);
|
$controller = new SettingsController($this->mockSettingsRepository, $this->mockLanguagesRepository);
|
||||||
$this->assertInstanceOf(SettingsController::class, $controller);
|
$this->assertInstanceOf(SettingsController::class, $controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
updates/0.20/ver_0.255.zip
Normal file
BIN
updates/0.20/ver_0.255.zip
Normal file
Binary file not shown.
0
updates/0.20/ver_0.255_files.txt
Normal file
0
updates/0.20/ver_0.255_files.txt
Normal file
@@ -1,4 +1,9 @@
|
|||||||
<b>ver. 0.254 - 12.02.2026</b><br />
|
<b>ver. 0.255 - 12.02.2026</b><br />
|
||||||
|
- UPDATE - kontrolery admin `Settings`, `Banners`, `Dictionaries`, `Articles` pobieraja liste jezykow przez `Domain\\Languages\\LanguagesRepository` (DI)
|
||||||
|
- UPDATE - routing DI (`admin\\Site`) przekazuje `LanguagesRepository` do kontrolerow `Articles`, `Banners`, `Settings`, `Dictionaries`
|
||||||
|
- UPDATE - aktywne legacy odwolania (`admin\\controls`, `admin\\factory\\Shop*`) przepiete z `admin\\factory\\Languages` na `LanguagesRepository`
|
||||||
|
- FIX - `autoload/admin/factory/class.Languages.php` uzywa `<?php` (zgodnosc z `short_open_tag=Off`)
|
||||||
|
<hr><b>ver. 0.254 - 12.02.2026</b><br />
|
||||||
- UPDATE - modul `Languages` w panelu admin przepiety na `Domain\\Languages\\LanguagesRepository` + `admin\\Controllers\\LanguagesController`
|
- UPDATE - modul `Languages` w panelu admin przepiety na `Domain\\Languages\\LanguagesRepository` + `admin\\Controllers\\LanguagesController`
|
||||||
- UPDATE - migracja widokow languages (`languages-list`, `language-edit`, `translations-list`, `translation-edit`) na `components/table-list` i `components/form-edit`
|
- UPDATE - migracja widokow languages (`languages-list`, `language-edit`, `translations-list`, `translation-edit`) na `components/table-list` i `components/form-edit`
|
||||||
- UPDATE - routing DI dla `Languages` w `admin\\Site` oraz kompatybilna fasada `admin\\factory\\Languages` delegujaca do repozytorium
|
- UPDATE - routing DI dla `Languages` w `admin\\Site` oraz kompatybilna fasada `admin\\factory\\Languages` delegujaca do repozytorium
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?
|
<?
|
||||||
$current_ver = 254;
|
$current_ver = 255;
|
||||||
|
|
||||||
for ($i = 1; $i <= $current_ver; $i++)
|
for ($i = 1; $i <= $current_ver; $i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user