ver. 0.273 - ShopProducer refactor + cleanup 6 factory facades

- Domain\Producer\ProducerRepository (CRUD + frontend)
- admin\Controllers\ShopProducerController (DI)
- Nowe widoki: producers-list, producer-edit (table-list/form-edit)
- shop\Producer -> fasada do ProducerRepository
- Przepiecie ShopProduct factory na TransportRepository
- Usuniete 6 pustych factory facades: Languages, Newsletter, Scontainers, ShopProducer, ShopTransport, Layouts
- Usuniete legacy: controls\ShopProducer, stare szablony
- Testy: 338 tests, 1063 assertions OK
This commit is contained in:
2026-02-15 10:46:55 +01:00
parent fe51a1f4c4
commit 3bac7616e7
26 changed files with 1134 additions and 632 deletions

View File

@@ -1,4 +1,4 @@
<?
<?php
namespace shop;
class Producer implements \ArrayAccess
{
@@ -6,43 +6,19 @@ class Producer implements \ArrayAccess
{
global $mdb;
$result = $mdb -> get( 'pp_shop_producer', '*', [ 'id' => $producer_id ] );
foreach ( $result as $key => $val )
$this -> $key = $val;
$repo = new \Domain\Producer\ProducerRepository( $mdb );
$data = $repo->find( $producer_id );
$rows = $mdb -> select( 'pp_shop_producer_lang', '*', [ 'producer_id' => $producer_id ] );
foreach ( $rows as $row )
{
$languages[ $row['lang_id'] ]['description'] = $row['description'];
$languages[ $row['lang_id'] ]['data'] = $row['data'];
$languages[ $row['lang_id'] ]['meta_title'] = $row['meta_title'];
}
$this -> languages = $languages;
foreach ( $data as $key => $val )
$this->$key = $val;
}
static public function producer_products( $producer_id, $lang_id, $bs )
{
global $mdb;
$count = $mdb -> count( 'pp_shop_products', [ 'AND' => [ 'producer_id' => $producer_id, 'status' => 1 ] ] );
$ls = ceil( $count / 12 );
if ( $bs < 1 )
$bs = 1;
else if ( $bs > $ls )
$bs = $ls;
$from = 12 * ( $bs - 1 );
if ( $from < 0 )
$from = 0;
$results['products'] = $mdb -> select( 'pp_shop_products', 'id', [ 'AND' => [ 'producer_id' => $producer_id, 'status' => 1 ], 'LIMIT' => [ $from, 12 ] ] );
$results['ls'] = $ls;
return $results;
$repo = new \Domain\Producer\ProducerRepository( $mdb );
return $repo->producerProducts( (int) $producer_id, 12, (int) $bs );
}
public function __get( $variable )