url() public static method

public static url ( ) : UrlType
return GraphQL\Examples\Blog\Type\Scalar\UrlType
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }