|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace ApiSkeletons\Doctrine\GraphQL\Type; |
|
6
|
|
|
|
|
7
|
|
|
use ApiSkeletons\Doctrine\GraphQL\AbstractContainer; |
|
8
|
|
|
use GraphQL\Type\Definition\Type; |
|
9
|
|
|
|
|
10
|
|
|
class TypeManager extends AbstractContainer |
|
11
|
|
|
{ |
|
12
|
|
|
public function __construct(protected AbstractContainer $container) |
|
13
|
|
|
{ |
|
14
|
|
|
$this |
|
15
|
|
|
->set('tinyint', static fn () => Type::int()) |
|
16
|
|
|
->set('smallint', static fn () => Type::int()) |
|
17
|
|
|
->set('integer', static fn () => Type::int()) |
|
18
|
|
|
->set('int', static fn () => Type::int()) |
|
19
|
|
|
->set('boolean', static fn () => Type::boolean()) |
|
20
|
|
|
->set('decimal', static fn () => Type::float()) |
|
21
|
|
|
->set('float', static fn () => Type::float()) |
|
22
|
|
|
->set('bigint', static fn () => Type::string()) |
|
23
|
|
|
->set('string', static fn () => Type::string()) |
|
24
|
|
|
->set('text', static fn () => Type::string()) |
|
25
|
|
|
->set('array', static fn () => Type::listOf(Type::string())) |
|
26
|
|
|
->set('simple_array', static fn () => Type::listOf(Type::string())) |
|
27
|
|
|
->set('guid', static fn () => Type::string()) |
|
28
|
|
|
->set('json', static fn () => new Json()) |
|
29
|
|
|
->set('date', static fn () => new Date()) |
|
30
|
|
|
->set('datetime', static fn () => new DateTime()) |
|
31
|
|
|
->set('datetimetz', static fn () => new DateTimeTZ()) |
|
32
|
|
|
->set('time', static fn () => new Time()) |
|
33
|
|
|
->set('date_immutable', static fn () => new DateImmutable()) |
|
34
|
|
|
->set('datetime_immutable', static fn () => new DateTimeImmutable()) |
|
35
|
|
|
->set('datetimetz_immutable', static fn () => new DateTimeTZImmutable()) |
|
36
|
|
|
->set('time_immutable', static fn () => new TimeImmutable()) |
|
37
|
|
|
->set('pageinfo', static fn () => new PageInfo()) |
|
38
|
|
|
->set('pagination', static fn () => new Pagination()); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function getContainer(): AbstractContainer |
|
42
|
|
|
{ |
|
43
|
|
|
return $this->container; |
|
44
|
|
|
} |
|
45
|
|
|
} |
|
46
|
|
|
|