b374k
m1n1 1.01
Apache/2.4.41 (Ubuntu)
Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64
uid=33(www-data) gid=33(www-data) groups=33(www-data)
server ip : 62.171.164.128 | your ip : 127.0.0.1
safemode OFF
 >  / home / dev2.destoffenstraat.com / app / code / Amasty / CheckoutGraphQl / Model / Resolver /
Filename/home/dev2.destoffenstraat.com/app/code/Amasty/CheckoutGraphQl/Model/Resolver/OrderDate.php
Size1.82 kb
Permissionrwxrwxrwx
Ownerroot : root
Create time17-Aug-2025 10:26
Last modified23-Nov-2022 12:33
Last accessed22-Aug-2025 02:07
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
<?php

declare(strict_types=1);

/**
* @author Amasty Team
* @copyright Copyright (c) 2022 Amasty (https://www.amasty.com)
* @package One Step Checkout GraphQL (System)
*/

namespace Amasty\CheckoutGraphQl\Model\Resolver;

use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
use Magento\Sales\Api\Data\OrderInterface;

class OrderDate implements ResolverInterface
{
/**
* @var OrderInterface
*/
private $orderModel;

/**
* @var TimezoneInterface
*/
private $timezone;

public function __construct(OrderInterface $orderModel, TimezoneInterface $timezone)
{
$this->orderModel = $orderModel;
$this->timezone = $timezone;
}

/**
* @param Field $field
* @param ContextInterface $context
* @param ResolveInfo $info
* @param array|null $value
* @param array|null $args
* @return string|null
* @throws GraphQlInputException
*/
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
{
if (!isset($value['order_number'])) {
throw new GraphQlInputException(__('"order_number" value must be specified'));
}

try {
$order = $this->orderModel->loadByIncrementId($value['order_number']);
} catch (LocalizedException $e) {
throw new GraphQlInputException(__($e->getMessage()), $e);
}

return $this->timezone->formatDate($order->getCreatedAt(), \IntlDateFormatter::MEDIUM);
}
}