Files
2025-08-02 16:30:27 +02:00

27 lines
629 B
PHP

<?php
declare(strict_types=1);
namespace KupShop\GraphQLBundle\ApiPublic\Controller;
use KupShop\GraphQLBundle\ApiAdmin\Annotation\Module;
use KupShop\GraphQLBundle\ApiPublic\Types\User\User;
use KupShop\KupShopBundle\Context\UserContext;
use KupShop\KupShopBundle\Util\Contexts;
use TheCodingMachine\GraphQLite\Annotations\Query;
class UserController
{
#[Query]
#[Module(\Modules::JS_SHOP)]
public function me(): ?User
{
$userContext = Contexts::get(UserContext::class);
if ($active = $userContext->getActive()) {
return new User($active);
}
return null;
}
}