ver. 0.294: Remove all 12 legacy autoload/shop/ classes (~2363 lines)

Complete Domain-Driven Architecture migration:
- Phase 1-4: Transport, ProductSet, Coupon, Shop, Search, Basket,
  ProductCustomField, Category, ProductAttribute, Promotion
- Phase 5: Order (~562 lines) + Product (~952 lines)
- ~20 Product methods migrated to ProductRepository
- Apilo sync migrated to OrderAdminService
- Production hotfixes: stale Redis cache (prices 0.00), unqualified
  Product:: refs in LayoutEngine, object->array template conversion
- AttributeRepository::getAttributeValueById() Redis cache added

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-18 02:05:39 +01:00
parent c72ba388a0
commit e1cb421aaf
74 changed files with 2176 additions and 2669 deletions

View File

@@ -2,14 +2,17 @@
namespace front\Controllers;
use Domain\Order\OrderRepository;
use Domain\Order\OrderAdminService;
class ShopOrderController
{
private $repository;
private $adminService;
public function __construct( OrderRepository $repository )
public function __construct( OrderRepository $repository, OrderAdminService $adminService )
{
$this->repository = $repository;
$this->adminService = $adminService;
}
public function paymentConfirmation()
@@ -30,12 +33,11 @@ class ShopOrderController
if ( \Shared\Helpers\Helpers::get( 'tr_status' ) == 'TRUE' && \Shared\Helpers\Helpers::get( 'tr_crc' ) )
{
$order = new \shop\Order( 0, \Shared\Helpers\Helpers::get( 'tr_crc' ) );
$order = $this->repository->findRawByHash( \Shared\Helpers\Helpers::get( 'tr_crc' ) );
if ( $order->id )
if ( $order && $order['id'] )
{
$order->set_as_paid( true );
$order->update_status( 4, true );
$this->adminService->setOrderAsPaid( (int)$order['id'], true );
echo 'TRUE';
exit;
}
@@ -68,14 +70,13 @@ class ShopOrderController
curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( $post ) );
$response = curl_exec( $ch );
$order = new \shop\Order( 0, '', \Shared\Helpers\Helpers::get( 'p24_session_id' ) );
$order = $this->repository->findRawByPrzelewy24Hash( \Shared\Helpers\Helpers::get( 'p24_session_id' ) );
if ( $order['status'] == 0 && $order['summary'] * 100 == \Shared\Helpers\Helpers::get( 'p24_amount' ) )
if ( $order && $order['status'] == 0 && $order['summary'] * 100 == \Shared\Helpers\Helpers::get( 'p24_amount' ) )
{
if ( $order['id'] )
{
$order->set_as_paid( true );
$order->update_status( 4, true );
$this->adminService->setOrderAsPaid( (int)$order['id'], true );
}
}
@@ -88,9 +89,9 @@ class ShopOrderController
if ( !empty( $_POST["KWOTA"] ) && !empty( $_POST["ID_PLATNOSCI"] ) && !empty( $_POST["ID_ZAMOWIENIA"] ) && !empty( $_POST["STATUS"] ) && !empty( $_POST["SEKRET"] ) && !empty( $_POST["HASH"] ) )
{
$order = new \shop\Order( $_POST['ID_ZAMOWIENIA'] );
$order = $this->repository->orderDetailsFrontend( (int)$_POST['ID_ZAMOWIENIA'] );
if ( $order['id'] )
if ( $order && $order['id'] )
{
if ( is_array( $order['products'] ) && count( $order['products'] ) ):
$summary_tmp = 0;
@@ -105,21 +106,20 @@ class ShopOrderController
{
if ( $_POST["STATUS"] == "SUCCESS" )
{
$order->set_as_paid( true );
$order->update_status( 4, true );
$this->adminService->setOrderAsPaid( (int)$order['id'], true );
echo \Shared\Helpers\Helpers::lang( 'zamowienie-zostalo-oplacone' );
}
else if ( $_POST["STATUS"] == "FAILURE" )
{
$order->update_status( 2, true );
$this->adminService->changeStatus( (int)$order['id'], 2, true );
echo \Shared\Helpers\Helpers::lang( 'platnosc-zostala-odrzucona' );
}
}
else
{
$order->update_status( 3, true );
$this->adminService->changeStatus( (int)$order['id'], 3, true );
echo \Shared\Helpers\Helpers::lang( 'zamowienie-zostalo-oplacone-reczne' );
}
@@ -136,7 +136,7 @@ class ShopOrderController
$order = $this->repository->orderDetailsFrontend(
$this->repository->findIdByHash( \Shared\Helpers\Helpers::get( 'order_hash' ) )
);
$coupon = (int)$order['coupon_id'] ? new \shop\Coupon( (int)$order['coupon_id'] ) : null;
$coupon = (int)$order['coupon_id'] ? ( new \Domain\Coupon\CouponRepository( $GLOBALS['mdb'] ) )->find( (int)$order['coupon_id'] ) : null;
return \Shared\Tpl\Tpl::view( 'shop-order/order-details', [
'order' => $order,