mirror of
https://framagit.org/tykayn/date-poll-api
synced 2023-08-25 08:23:11 +02:00
add graphql bundle
This commit is contained in:
parent
d286d6291e
commit
8fbd546205
5077
composer-setup.php
Normal file
5077
composer-setup.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -9,8 +9,9 @@
|
||||
"ext-pdo_mysql": "*",
|
||||
"friendsofsymfony/rest-bundle": "^2.6",
|
||||
"jms/serializer-bundle": "^3.4",
|
||||
"nelmio/api-doc-bundle": "^3.4",
|
||||
"nelmio/api-doc-bundle": "^4.0",
|
||||
"nelmio/cors-bundle": "^2.0",
|
||||
"overblog/graphql-bundle": "^0.13.4",
|
||||
"sensio/framework-extra-bundle": "^5.5",
|
||||
"swiftmailer/swiftmailer": "^6.0",
|
||||
"symfony/config": "4.3.*",
|
||||
|
3419
composer.lock
generated
3419
composer.lock
generated
File diff suppressed because it is too large
Load Diff
BIN
composer.phar
Executable file
BIN
composer.phar
Executable file
Binary file not shown.
@ -16,4 +16,5 @@ return [
|
||||
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
|
||||
Liip\TestFixturesBundle\LiipTestFixturesBundle::class => ['test' => true],
|
||||
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
|
||||
Overblog\GraphQLBundle\OverblogGraphQLBundle::class => ['all' => true],
|
||||
];
|
||||
|
0
config/graphql/types/.gitignore
vendored
Normal file
0
config/graphql/types/.gitignore
vendored
Normal file
26
config/graphql/types/Apartment.types.yaml
Normal file
26
config/graphql/types/Apartment.types.yaml
Normal file
@ -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"
|
7
config/graphql/types/Query.types.yaml
Normal file
7
config/graphql/types/Query.types.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
Query:
|
||||
type: object
|
||||
config:
|
||||
description: "Apartments ORM repository"
|
||||
fields:
|
||||
apartment:
|
||||
type: "apartment"
|
10
config/packages/graphql.yaml
Normal file
10
config/packages/graphql.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
overblog_graphql:
|
||||
definitions:
|
||||
schema:
|
||||
query: Query
|
||||
mappings:
|
||||
types:
|
||||
-
|
||||
type: yaml
|
||||
dir: "%kernel.project_dir%/config/graphql/types"
|
||||
suffix: null
|
3
config/routes/graphql.yaml
Normal file
3
config/routes/graphql.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
overblog_graphql_endpoint:
|
||||
resource: "@OverblogGraphQLBundle/Resources/config/routing/graphql.yml"
|
||||
prefix: api/graphql
|
@ -26,3 +26,4 @@ services:
|
||||
|
||||
# add more service definitions when explicit configuration is needed
|
||||
# please note that last definitions always *replace* previous ones
|
||||
Doctrine\ORM\EntityManager: "@doctrine.orm.default_entity_manager"
|
||||
|
30
src/GraphQL/Resolver/ApartmentResolver.php
Normal file
30
src/GraphQL/Resolver/ApartmentResolver.php
Normal file
@ -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',
|
||||
];
|
||||
}
|
||||
}
|
38
symfony.lock
38
symfony.lock
@ -90,12 +90,12 @@
|
||||
"doctrine/reflection": {
|
||||
"version": "v1.0.0"
|
||||
},
|
||||
"doctrine/sql-formatter": {
|
||||
"version": "1.1.1"
|
||||
},
|
||||
"egulias/email-validator": {
|
||||
"version": "2.1.15"
|
||||
},
|
||||
"exsyst/swagger": {
|
||||
"version": "v0.4.1"
|
||||
},
|
||||
"friendsofsymfony/rest-bundle": {
|
||||
"version": "2.2",
|
||||
"recipe": {
|
||||
@ -170,6 +170,15 @@
|
||||
"config/packages/prod/jms_serializer.yaml"
|
||||
]
|
||||
},
|
||||
"laminas/laminas-code": {
|
||||
"version": "3.4.1"
|
||||
},
|
||||
"laminas/laminas-eventmanager": {
|
||||
"version": "3.3.0"
|
||||
},
|
||||
"laminas/laminas-zendframework-bridge": {
|
||||
"version": "1.1.1"
|
||||
},
|
||||
"liip/test-fixtures-bundle": {
|
||||
"version": "1.8.0"
|
||||
},
|
||||
@ -207,6 +216,20 @@
|
||||
"ocramius/proxy-manager": {
|
||||
"version": "2.2.3"
|
||||
},
|
||||
"overblog/graphql-bundle": {
|
||||
"version": "0.12",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes-contrib",
|
||||
"branch": "master",
|
||||
"version": "0.12",
|
||||
"ref": "c01dcfb85a6e93f1a43ef36151fcff11cf17f791"
|
||||
},
|
||||
"files": [
|
||||
"config/graphql/types/.gitignore",
|
||||
"config/packages/graphql.yaml",
|
||||
"config/routes/graphql.yaml"
|
||||
]
|
||||
},
|
||||
"php": {
|
||||
"version": "7.4"
|
||||
},
|
||||
@ -398,6 +421,9 @@
|
||||
"symfony/polyfill-intl-idn": {
|
||||
"version": "v1.12.0"
|
||||
},
|
||||
"symfony/polyfill-intl-normalizer": {
|
||||
"version": "v1.20.0"
|
||||
},
|
||||
"symfony/polyfill-mbstring": {
|
||||
"version": "v1.12.0"
|
||||
},
|
||||
@ -527,9 +553,15 @@
|
||||
"twig/twig": {
|
||||
"version": "v2.12.3"
|
||||
},
|
||||
"webimpress/safe-writer": {
|
||||
"version": "2.1.0"
|
||||
},
|
||||
"webmozart/assert": {
|
||||
"version": "1.5.0"
|
||||
},
|
||||
"webonyx/graphql-php": {
|
||||
"version": "v0.13.9"
|
||||
},
|
||||
"willdurand/jsonp-callback-validator": {
|
||||
"version": "v1.1.0"
|
||||
},
|
||||
|
@ -10,7 +10,7 @@
|
||||
<i class="fa fa-home"></i>
|
||||
<img src="{{ WEBSITE_LOGO }}" alt="logo">
|
||||
{{ WEBSITE_NAME }}
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user