imageSizeEnum() 공개 정적인 메소드

public static imageSizeEnum ( ) : ImageSizeEnumType
리턴 GraphQL\Examples\Blog\Type\Enum\ImageSizeEnumType
예제 #1
0
 public function __construct()
 {
     $config = ['name' => 'ImageType', 'fields' => ['id' => Types::id(), 'type' => new EnumType(['name' => 'ImageTypeEnum', 'values' => ['USERPIC' => Image::TYPE_USERPIC]]), 'size' => Types::imageSizeEnum(), 'width' => Types::int(), 'height' => Types::int(), 'url' => ['type' => Types::url(), 'resolve' => [$this, 'resolveUrl']], 'fieldWithError' => ['type' => Types::string(), 'resolve' => function () {
         throw new \Exception("Field with exception");
     }], 'nonNullFieldWithError' => ['type' => Types::nonNull(Types::string()), 'resolve' => function () {
         throw new \Exception("Non-null field with exception");
     }]]];
     parent::__construct($config);
 }
예제 #2
0
 public function __construct()
 {
     // Option #2: define type using inheritance, see any other object type for compositional example
     $config = ['name' => 'ImageType', 'fields' => ['id' => Types::id(), 'type' => new EnumType(['name' => 'ImageTypeEnum', 'values' => ['USERPIC' => Image::TYPE_USERPIC]]), 'size' => Types::imageSizeEnum(), 'width' => Types::int(), 'height' => Types::int(), 'url' => ['type' => Types::url(), 'resolve' => [$this, 'resolveUrl']], 'fieldWithError' => ['type' => Types::string(), 'resolve' => function () {
         throw new \Exception("Field with exception");
     }], 'nonNullFieldWithError' => ['type' => Types::nonNull(Types::string()), 'resolve' => function () {
         throw new \Exception("Non-null field with exception");
     }]]];
     parent::__construct($config);
 }
예제 #3
0
 public function __construct()
 {
     $config = ['name' => 'User', 'description' => 'Our blog authors', 'fields' => function () {
         return ['id' => Types::id(), 'email' => Types::email(), 'photo' => ['type' => Types::image(), 'description' => 'User photo URL', 'args' => ['size' => Types::nonNull(Types::imageSizeEnum())]], 'firstName' => ['type' => Types::string()], 'lastName' => ['type' => Types::string()], 'lastStoryPosted' => Types::story(), 'fieldWithError' => ['type' => Types::string(), 'resolve' => function () {
             throw new \Exception("This is error field");
         }]];
     }, 'interfaces' => [Types::node()], 'resolveField' => function ($value, $args, $context, ResolveInfo $info) {
         if (method_exists($this, $info->fieldName)) {
             return $this->{$info->fieldName}($value, $args, $context, $info);
         } else {
             return $value->{$info->fieldName};
         }
     }];
     parent::__construct($config);
 }
예제 #4
0
 public function __construct()
 {
     // Option #1: using composition over inheritance to define type, see ImageType for inheritance example
     $this->definition = new ObjectType(['name' => 'User', 'description' => 'Our blog authors', 'fields' => function () {
         return ['id' => Types::id(), 'email' => Types::email(), 'photo' => ['type' => Types::image(), 'description' => 'User photo URL', 'args' => ['size' => Types::nonNull(Types::imageSizeEnum())]], 'firstName' => ['type' => Types::string()], 'lastName' => ['type' => Types::string()], 'lastStoryPosted' => Types::story(), 'fieldWithError' => ['type' => Types::string(), 'resolve' => function () {
             throw new \Exception("This is error field");
         }]];
     }, 'interfaces' => [Types::node()], 'resolveField' => function ($value, $args, $context, ResolveInfo $info) {
         if (method_exists($this, $info->fieldName)) {
             return $this->{$info->fieldName}($value, $args, $context, $info);
         } else {
             return $value->{$info->fieldName};
         }
     }]);
 }