Files
shopPRO/autoload/shop/class.Producer.php
Jacek Pyziak 3bac7616e7 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
2026-02-15 10:46:55 +01:00

54 lines
1.1 KiB
PHP

<?php
namespace shop;
class Producer implements \ArrayAccess
{
public function __construct( int $producer_id )
{
global $mdb;
$repo = new \Domain\Producer\ProducerRepository( $mdb );
$data = $repo->find( $producer_id );
foreach ( $data as $key => $val )
$this->$key = $val;
}
static public function producer_products( $producer_id, $lang_id, $bs )
{
global $mdb;
$repo = new \Domain\Producer\ProducerRepository( $mdb );
return $repo->producerProducts( (int) $producer_id, 12, (int) $bs );
}
public function __get( $variable )
{
if ( array_key_exists( $variable, $this -> data ) )
return $this -> $variable;
}
public function __set( $variable, $value )
{
$this -> $variable = $value;
}
public function offsetExists( $offset )
{
return isset( $this -> $offset );
}
public function offsetGet( $offset )
{
return $this -> $offset;
}
public function offsetSet( $offset, $value )
{
$this -> $offset = $value;
}
public function offsetUnset( $offset )
{
unset( $this -> $offset );
}
}