Bonjour à tous j'ouvre ce topic pour avoir une réponse car il y avait un vieux message concernant ce sujet qui n'a pas trouvé de réponses:
Voilà, j'ai un message d'erreur quand je veux accéder à une commande.
C'est ennuyeux car je ne peux pas interagir avec cette commande (remboursement ou autre)
Voici l'erreur que j'ai en mode débug:
désolé si c'est un peu long:
voici en premier ce qui sort quand le mode débug n'est pas activé:
Oups... une erreur inattendue semble s'être produite
Attempted to load class "OrderProductForViewing" from namespace "PrestaShop\PrestaShop\Core\Domain\Order\QueryResult". Did you forget a "use" statement for another namespace?
[Symfony\Component\Debug\Exception\ClassNotFoundException 0]
et ceci en mode débug:
Type error: Argument 6 passed to PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderProductForViewing::__construct() must be of the type string, null given, called in /home/xxxx/public_html/src/Adapter/Order/QueryHandler/GetOrderProductsForViewingHandler.php on line 247
FatalThrowableError
in src/Core/Domain/Order/QueryResult/OrderProductForViewing.php (line 189)
* @param string $type
* @param bool $availableOutOfStock
* @param array $packItems
* @param OrderProductCustomizationsForViewing|null $customizations
*/
public function __construct(
?int $orderDetailId,
int $id,
int $combinationId,
string $name,
string $reference,
OrderProductForViewing->__construct(null, 2231, 0, 'MIJOTÉ DE CANARD 700G', '2086', null, '1', 0, 0, 38, '/img/tmp/product_mini_2231_0.jpg?time=1729004063', '0', '0', '0', '0,00 €', 0, '0,00 €', '0', '', null, '', 'product_without_combinations', false)in src/Adapter/Order/QueryHandler/GetOrderProductsForViewingHandler.php (line 247)
'0',
$pack_item['location'],
null,
'',
$packItemType,
(bool) Product::isAvailableWhenOutOfStock(StockAvailable::outOfStock($pack_item['id_product']))
);
}
$productsForViewing[] = new OrderProductForViewing(
$product['id_order_detail'],
GetOrderProductsForViewingHandler->handle(object(GetOrderProductsForViewing))in src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php (line 848)
* @throws InvalidSortingException
*/
private function getOrderProducts(OrderId $orderId, string $productsOrder): OrderProductsForViewing
{
return $this->getOrderProductsForViewingHandler->handle(
GetOrderProductsForViewing::all($orderId->getValue(), $productsOrder)
);
}
/**
* If there is no valid customer attached to the order, the customer must have been deleted
GetOrderForViewingHandler->getOrderProducts(object(OrderId), 'DESC')in src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php (line 212)
$invoiceManagementIsEnabled,
new DateTimeImmutable($order->date_add),
$this->getOrderCustomer($order, $orderInvoiceAddress),
$this->getOrderShippingAddress($order),
$orderInvoiceAddress,
$this->getOrderProducts($query->getOrderId(), $query->getProductsSorting()->getValue()),
$this->getOrderHistory($order),
$this->getOrderDocuments($order),
$this->getOrderShipping($order),
$this->getOrderReturns($order),
$this->getOrderPayments($order),
GetOrderForViewingHandler->handle(object(GetOrderForViewing))in vendor/league/tactician/src/Handler/CommandHandlerMiddleware.php (line 71)
$command,
"Method '{$methodName}' does not exist on handler"
);
}
return $handler->{$methodName}($command);
}
}
CommandHandlerMiddleware->execute(object(GetOrderForViewing), object(Closure))in vendor/league/tactician/src/CommandBus.php (line 62)
if (! $middleware instanceof Middleware) {
throw InvalidMiddlewareException::forMiddleware($middleware);
}
$lastCallable = function ($command) use ($middleware, $lastCallable) {
return $middleware->execute($command, $lastCallable);
};
}
return $lastCallable;
}
CommandBus->League\Tactician\{closure}(object(GetOrderForViewing))in src/Core/CommandBus/Middleware/CommandRegisterMiddleware.php (line 79)
$commandName = $this->commandNameExtractor->extract($command);
$handler = $this->handlerLocator->getHandlerForCommand($commandName);
$this->executedCommandRegistry->register($command, $handler);
return $next($command);
}
}
CommandRegisterMiddleware->execute(object(GetOrderForViewing), object(Closure))in vendor/league/tactician/src/CommandBus.php (line 62)
if (! $middleware instanceof Middleware) {
throw InvalidMiddlewareException::forMiddleware($middleware);
}
$lastCallable = function ($command) use ($middleware, $lastCallable) {
return $middleware->execute($command, $lastCallable);
};
}
return $lastCallable;
}
CommandBus->League\Tactician\{closure}(object(GetOrderForViewing))in vendor/league/tactician/src/CommandBus.php (line 42)
if (!is_object($command)) {
throw InvalidCommandException::forUnknownValue($command);
}
$middlewareChain = $this->middlewareChain;
return $middlewareChain($command);
}
/**
* @param Middleware[] $middlewareList
*
CommandBus->handle(object(GetOrderForViewing))in src/Core/CommandBus/TacticianCommandBusAdapter.php (line 54)
/**
* {@inheritdoc}
*/
public function handle($command)
{
return $this->bus->handle($command);
}
}
TacticianCommandBusAdapter->handle(object(GetOrderForViewing))in src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php (line 420)
*/
public function viewAction(int $orderId, Request $request): Response
{
try {
/** @var OrderForViewing $orderForViewing */
$orderForViewing = $this->getQueryBus()->handle(new GetOrderForViewing($orderId, QuerySorting::DESC));
} catch (OrderException $e) {
$this->addFlash('error', $this->getErrorMessageForException($e, $this->getErrorMessages($e)));
return $this->redirectToRoute('admin_orders_index');
}
OrderController->viewAction(161, object(Request))in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php (line 151)
$this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS, $event);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = \call_user_func_array($controller, $arguments);
// view
if (!$response instanceof Response) {
$event = new GetResponseForControllerResultEvent($this, $request, $type, $response);
$this->dispatcher->dispatch(KernelEvents::VIEW, $event);
HttpKernel->handleRaw(object(Request), 1)in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php (line 68)
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
HttpKernel->handle(object(Request), 1, false)in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php (line 200)
$this->boot();
++$this->requestStackSize;
$this->resetServices = true;
try {
return $this->getHttpKernel()->handle($request, $type, $catch);
} finally {
--$this->requestStackSize;
}
}
Kernel->handle(object(Request), 1, false)in adminxxxxxxxx/index.php (line 82)
$request = Request::createFromGlobals();
Request::setTrustedProxies([], Request::HEADER_X_FORWARDED_ALL);
try {
require_once __DIR__.'/../autoload.php';
$response = $kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, false);
$response->send();
$kernel->terminate($request, $response);
} catch (NotFoundHttpException $exception) {
define('ADMIN_LEGACY_CONTEXT', true);
// correct Apache charset (except if it's too late)
je vous remercie par avance si vous pouvez me mettre sur une piste.
Sachant que j'ai déjà vidé le cache et que le problème persiste.
Merci à tous.