/**
  * @param FieldContainer $type
  * @return GQLDefinition\ObjectType
  */
 private function createType(FieldContainer $type)
 {
     if (null !== $type->getFields()) {
         $this->prepareFields($type->getFields());
     }
     $type = new GQLDefinition\ObjectType($type->toMapping());
     return $type;
 }
Example #2
0
 /**
  * @param FieldContainer $type
  * @return GQLDefinition\Type
  */
 private function createType(FieldContainer $type)
 {
     if (null !== $type->getFields()) {
         $this->prepareFields($type->getFields(), $type);
     }
     if ($type instanceof Type) {
         $this->resolveInterfaces($type);
     }
     $internalType = $type->getInternalType();
     switch ($internalType) {
         case 'ObjectType':
             return new GQLDefinition\ObjectType($type->toMapping());
         case 'EnumType':
             return new GQLDefinition\EnumType($type->toMapping());
         default:
             throw new \InvalidArgumentException(sprintf('Undefined internal type "%s"', $internalType));
     }
 }