-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
guillaume leclercq
committed
Feb 27, 2017
1 parent
d48a13f
commit afd315a
Showing
7 changed files
with
44 additions
and
7 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace AppBundle\GraphQL\Query\Band; | ||
|
||
use AppBundle\Entity\Band; | ||
use AppBundle\GraphQL\Type\BandType; | ||
use Youshido\GraphQL\Execution\ResolveInfo; | ||
use Youshido\GraphQL\Type\AbstractType; | ||
use Youshido\GraphQL\Type\ListType\ListType; | ||
use Youshido\GraphQL\Type\Object\AbstractObjectType; | ||
use Youshido\GraphQL\Type\Scalar\StringType; | ||
use Youshido\GraphQLBundle\Field\AbstractContainerAwareField; | ||
use Youshido\GraphQL\Config\Field\FieldConfig; | ||
|
||
class BandsFieldByStyle extends AbstractContainerAwareField | ||
{ | ||
public function build(FieldConfig $config) | ||
{ | ||
$config->addArguments([ | ||
'style_name' => new StringType(), | ||
]); | ||
} | ||
|
||
public function resolve($value, array $args, ResolveInfo $info) | ||
{ | ||
$em = $this->container->get('doctrine')->getManager(); | ||
$repository = $em->getRepository(Band::class); | ||
|
||
return $repository->findByStyleName($args['style_name']); | ||
} | ||
|
||
/** | ||
* @return AbstractObjectType|AbstractType | ||
*/ | ||
public function getType() | ||
{ | ||
return new ListType(new BandType()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters