ver. 0.284: DbModel elimination, update packages for 0.283-0.284
- Removed class.DbModel.php — only consumer (shop\Promotion) now has inlined constructor + __get() - Created update packages: ver_0.283.zip (S→Helpers migration, ~130 files), ver_0.284.zip (DbModel removal) - Updated docs: CHANGELOG, PROJECT_STRUCTURE, FRONTEND_REFACTORING_PLAN Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
<?php
|
||||
namespace shop;
|
||||
|
||||
use DbModel;
|
||||
|
||||
class Promotion extends DbModel
|
||||
class Promotion
|
||||
{
|
||||
public $table = 'pp_shop_promotion';
|
||||
private $data = [];
|
||||
|
||||
public static $condition_type = [
|
||||
1 => 'Rabat procentowy na produkty z kategorii 1 jeżeli w koszyku jest produkt z kategorii 2',
|
||||
@@ -17,6 +15,25 @@ class Promotion extends DbModel
|
||||
|
||||
public static $discount_type = [ 1 => 'Rabat procentowy' ];
|
||||
|
||||
public function __construct( $id )
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
if ( $id )
|
||||
{
|
||||
$result = $mdb->get( 'pp_shop_promotion', '*', [ 'id' => $id ] );
|
||||
if ( is_array( $result ) )
|
||||
$this->data = $result;
|
||||
}
|
||||
}
|
||||
|
||||
public function __get( $variable )
|
||||
{
|
||||
if ( isset( $this->data[$variable] ) )
|
||||
return $this->data[$variable];
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function get_active_promotions()
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
Reference in New Issue
Block a user