78 lines
2.1 KiB
PHP
78 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KupShop\GraphQLBundle\ApiAdmin\Controller\Content;
|
|
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Collection\PageCollection;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Collection\SystemPageCollection;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Page\Input\PageFilterInput;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Page\Page;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Parameters;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\SystemPage\Input\SystemPageFilterInput;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\SystemPage\SystemPage;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Util\Content\PageUtil;
|
|
use TheCodingMachine\GraphQLite\Annotations\Query;
|
|
use TheCodingMachine\GraphQLite\Annotations\UseInputType;
|
|
|
|
readonly class PageController
|
|
{
|
|
public function __construct(
|
|
private PageUtil $pageUtil,
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* Vrací stránku podle ID.
|
|
*/
|
|
#[Query]
|
|
public function page(int $id): ?Page
|
|
{
|
|
return $this->pageUtil->getPage($id);
|
|
}
|
|
|
|
/**
|
|
* Vrací systémovou stránku podle ID.
|
|
*/
|
|
#[Query]
|
|
public function systemPage(int $id): ?SystemPage
|
|
{
|
|
return $this->pageUtil->getSystemPage($id);
|
|
}
|
|
|
|
/**
|
|
* Vrací seznam stránek.
|
|
*/
|
|
#[Query]
|
|
public function pages(
|
|
int $offset = 0,
|
|
int $limit = 100,
|
|
#[UseInputType('PageSortInput')] ?Parameters $sort = null,
|
|
?PageFilterInput $filter = null,
|
|
): PageCollection {
|
|
return $this->pageUtil->getPages($offset, $limit, $sort, $filter);
|
|
}
|
|
|
|
/**
|
|
* Vrací seznam systémových stránek.
|
|
*/
|
|
#[Query]
|
|
public function systemPages(
|
|
int $offset = 0,
|
|
int $limit = 100,
|
|
#[UseInputType('SystemPageSortInput')] ?Parameters $sort = null,
|
|
?SystemPageFilterInput $filter = null,
|
|
): SystemPageCollection {
|
|
return $this->pageUtil->getSystemPages($offset, $limit, $sort, $filter);
|
|
}
|
|
|
|
/**
|
|
* Vrací seznam fragmentů.
|
|
*/
|
|
#[Query]
|
|
public function fragments(): PageCollection
|
|
{
|
|
return $this->pageUtil->getFragments();
|
|
}
|
|
}
|