|
|
|
@ -5,7 +5,6 @@ declare(strict_types=1);
|
|
|
|
|
namespace SPIP\GraphQL;
|
|
|
|
|
|
|
|
|
|
use GraphQL\Type\Definition\Type;
|
|
|
|
|
use GraphQL\Type\Definition\HasFieldsType;
|
|
|
|
|
use GraphQL\Type\Definition\CustomScalarType;
|
|
|
|
|
use GraphQL\Type\Definition\ObjectType;
|
|
|
|
|
use GraphQL\Type\Definition\InterfaceType;
|
|
|
|
@ -23,7 +22,7 @@ class SchemaSPIP {
|
|
|
|
|
public array $metas_autorisees = [];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var array<string, HasFieldsType>
|
|
|
|
|
* @var array<ObjectType, InterfaceType, EnumType>
|
|
|
|
|
*/
|
|
|
|
|
private array $types = [];
|
|
|
|
|
|
|
|
|
@ -33,12 +32,12 @@ class SchemaSPIP {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Query, Date, MetaList, Article, SearchResult...
|
|
|
|
|
public function get(string $name): HasFieldsType {
|
|
|
|
|
public function get(string $name) {
|
|
|
|
|
return $this->types[$name] ??= $this->getType($name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Pour créer un nouveau Type de données, c'est par ici
|
|
|
|
|
private function getType(string $name): HasFieldsType {
|
|
|
|
|
private function getType(string $name) {
|
|
|
|
|
$typeDefinition = ['name' => $name];
|
|
|
|
|
|
|
|
|
|
// Types personnalisés (perme de surcharger les types du plugin et de créer ses propres types)
|
|
|
|
|