44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KupShop\GraphQLBundle\ApiAdmin\Controller\Content;
|
|
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Collection\TemplateCollection;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Parameters;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Template\Input\TemplateFilterInput;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Template\Template;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Util\Content\TemplateUtil;
|
|
use TheCodingMachine\GraphQLite\Annotations\Query;
|
|
use TheCodingMachine\GraphQLite\Annotations\UseInputType;
|
|
|
|
readonly class TemplateController
|
|
{
|
|
public function __construct(
|
|
private TemplateUtil $templateUtil,
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* Vrací šablonu podle ID.
|
|
*/
|
|
#[Query]
|
|
public function template(int $id): ?Template
|
|
{
|
|
return $this->templateUtil->getTemplate($id);
|
|
}
|
|
|
|
/**
|
|
* Vrací seznam šablon.
|
|
*/
|
|
#[Query]
|
|
public function templates(
|
|
int $offset = 0,
|
|
int $limit = 100,
|
|
#[UseInputType('TemplateSortInput')] ?Parameters $sort = null,
|
|
?TemplateFilterInput $filter = null,
|
|
): TemplateCollection {
|
|
return $this->templateUtil->getTemplates($offset, $limit, $sort, $filter);
|
|
}
|
|
}
|