1414use Magento \Framework \GraphQl \Query \Resolver \ContextInterface ;
1515use Magento \Framework \GraphQl \Query \Resolver \Value ;
1616use Magento \Framework \GraphQl \Query \ResolverInterface ;
17+ use Magento \Framework \GraphQl \Query \Uid ;
1718use Magento \Framework \GraphQl \Schema \Type \ResolveInfo ;
1819use Magento \GiftMessage \Api \OrderRepositoryInterface ;
1920use Psr \Log \LoggerInterface ;
@@ -33,16 +34,21 @@ class GiftMessage implements ResolverInterface
3334 */
3435 private LoggerInterface $ logger ;
3536
37+ /** @var Uid */
38+ private $ uidEncoder ;
39+
3640 /**
3741 * @param OrderRepositoryInterface $orderRepository
3842 * @param LoggerInterface|null $logger
3943 */
4044 public function __construct (
4145 OrderRepositoryInterface $ orderRepository ,
42- LoggerInterface $ logger = null
46+ LoggerInterface $ logger = null ,
47+ Uid $ uidEncoder = null
4348 ) {
4449 $ this ->orderRepository = $ orderRepository ;
4550 $ this ->logger = $ logger ?? ObjectManager::getInstance ()->get (LoggerInterface::class);
51+ $ this ->uidEncoder = $ uidEncoder ?? ObjectManager::getInstance ()->get (Uid::class);
4652 }
4753
4854 /**
@@ -68,8 +74,8 @@ public function resolve(
6874 if (!isset ($ value ['id ' ])) {
6975 throw new GraphQlInputException (__ ('"id" value should be specified ' ));
7076 }
71- // phpcs:ignore Magento2.Functions.DiscouragedFunction
72- $ orderId = ( int ) base64_decode ( $ value [ ' id ' ]) ?: ( int ) $ value ['id ' ];
77+
78+ $ orderId = $ this -> uidEncoder -> decode (( string ) $ value ['id ' ]) ;
7379
7480 try {
7581 $ orderGiftMessage = $ this ->orderRepository ->get ($ orderId );
0 commit comments