parent
d286d6291e
commit
8fbd546205
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -0,0 +1,26 @@
|
||||
Apartment:
|
||||
type: object
|
||||
config:
|
||||
description: "An apartment"
|
||||
fields:
|
||||
id:
|
||||
type: "Int!"
|
||||
description: "The unique ID of the apartment."
|
||||
street_address:
|
||||
type: "String"
|
||||
description: "Address of the apartment"
|
||||
country:
|
||||
type: "String"
|
||||
description: "Country of the Apartment"
|
||||
city:
|
||||
type: "String"
|
||||
description: "City of the Apartment"
|
||||
zipcode:
|
||||
type: "String"
|
||||
description: "Zipcode of the Apartment"
|
||||
build_year:
|
||||
type: "Int"
|
||||
description: "Build year of the Apartment"
|
||||
size:
|
||||
type: "Int"
|
||||
description: "Size of the Apartment"
|
@ -0,0 +1,7 @@
|
||||
Query:
|
||||
type: object
|
||||
config:
|
||||
description: "Apartments ORM repository"
|
||||
fields:
|
||||
apartment:
|
||||
type: "apartment"
|
@ -0,0 +1,10 @@
|
||||
overblog_graphql:
|
||||
definitions:
|
||||
schema:
|
||||
query: Query
|
||||
mappings:
|
||||
types:
|
||||
-
|
||||
type: yaml
|
||||
dir: "%kernel.project_dir%/config/graphql/types"
|
||||
suffix: null
|
@ -0,0 +1,3 @@
|
||||
overblog_graphql_endpoint:
|
||||
resource: "@OverblogGraphQLBundle/Resources/config/routing/graphql.yml"
|
||||
prefix: api/graphql
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\GraphQL\Resolver;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Overblog\GraphQLBundle\Definition\Argument;
|
||||
use Overblog\GraphQLBundle\Definition\Resolver\AliasedInterface;
|
||||
use Overblog\GraphQLBundle\Definition\Resolver\ResolverInterface;
|
||||
|
||||
class ApartmentResolver implements ResolverInterface {
|
||||
|
||||
private $em;
|
||||
|
||||
public function __construct( EntityManager $em ) {
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function resolve( Argument $args ) {
|
||||
$apartment = $this->em->getRepository( 'App:Apartment' )->find( $args[ 'id' ] );
|
||||
|
||||
return $apartment;
|
||||
}
|
||||
|
||||
public function getAliases() {
|
||||
return [
|
||||
'resolve',
|
||||
'Apartment',
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Reference in new issue