Youshido\GraphQL\Execution\Request::getFragments PHP Method

getFragments() public method

public getFragments ( ) : Fragment[]
return Youshido\GraphQL\Parser\Ast\Fragment[]
    public function getFragments()
    {
        return $this->fragments;
    }

Usage Example

Example #1
0
 private function assetFragmentsUsed(Request $request)
 {
     foreach ($request->getFragmentReferences() as $fragmentReference) {
         $request->getFragment($fragmentReference->getName())->setUsed(true);
     }
     foreach ($request->getFragments() as $fragment) {
         if (!$fragment->isUsed()) {
             throw new InvalidRequestException(sprintf('Fragment "%s" not used', $fragment->getName()), $fragment->getLocation());
         }
     }
 }
All Usage Examples Of Youshido\GraphQL\Execution\Request::getFragments