public function build($config) { parent::build($config); $config->getField('friends')->getConfig()->set('resolve', function ($droid) { return StarWarsData::getFriends($droid); }); $config->addField('primaryFunction', TypeMap::TYPE_STRING); }
public function build($config) { $config->addField('id', new NonNullType(new IdType()))->addField('name', new NonNullType(new StringType()))->addField('friends', ['type' => new ListType(new CharacterInterface()), 'resolve' => function ($droid) { return StarWarsData::getFriends($droid); }])->addField('appearsIn', new ListType(new EpisodeEnum()))->addField('homePlanet', TypeMap::TYPE_STRING); }