Ejemplo n.º 1
0
 public function testConnectionDefinitions()
 {
     $nodeType = new ObjectType(['name' => 'test']);
     $config = ['nodeType' => $nodeType];
     $this->assertEquals(Connection::connectionDefinitions($config), Relay::connectionDefinitions($config));
 }
Ejemplo n.º 2
0
 /**
  * We define a connection between a faction and its ships.
  *
  * connectionType implements the following type system shorthand:
  *   type ShipConnection {
  *     edges: [ShipEdge]
  *     pageInfo: PageInfo!
  *   }
  *
  * connectionType has an edges field - a list of edgeTypes that implement the
  * following type system shorthand:
  *   type ShipEdge {
  *     cursor: String!
  *     node: Ship
  *   }
  */
 protected static function getShipConnection()
 {
     if (self::$shipConnection === null) {
         $shipType = self::getShipType();
         $shipConnection = Relay::connectionDefinitions(['nodeType' => $shipType]);
         self::$shipConnection = $shipConnection;
     }
     return self::$shipConnection;
 }