add graphql bundle

This commit is contained in:
tykayn 2020-10-28 15:46:39 +01:00
parent d286d6291e
commit 8fbd546205
14 changed files with 7081 additions and 1536 deletions

5077
composer-setup.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -9,8 +9,9 @@
"ext-pdo_mysql": "*", "ext-pdo_mysql": "*",
"friendsofsymfony/rest-bundle": "^2.6", "friendsofsymfony/rest-bundle": "^2.6",
"jms/serializer-bundle": "^3.4", "jms/serializer-bundle": "^3.4",
"nelmio/api-doc-bundle": "^3.4", "nelmio/api-doc-bundle": "^4.0",
"nelmio/cors-bundle": "^2.0", "nelmio/cors-bundle": "^2.0",
"overblog/graphql-bundle": "^0.13.4",
"sensio/framework-extra-bundle": "^5.5", "sensio/framework-extra-bundle": "^5.5",
"swiftmailer/swiftmailer": "^6.0", "swiftmailer/swiftmailer": "^6.0",
"symfony/config": "4.3.*", "symfony/config": "4.3.*",

3419
composer.lock generated

File diff suppressed because it is too large Load Diff

BIN
composer.phar Executable file

Binary file not shown.

View File

@ -16,4 +16,5 @@ return [
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
Liip\TestFixturesBundle\LiipTestFixturesBundle::class => ['test' => true], Liip\TestFixturesBundle\LiipTestFixturesBundle::class => ['test' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
Overblog\GraphQLBundle\OverblogGraphQLBundle::class => ['all' => true],
]; ];

0
config/graphql/types/.gitignore vendored Normal file
View File

View 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"

View File

@ -0,0 +1,7 @@
Query:
type: object
config:
description: "Apartments ORM repository"
fields:
apartment:
type: "apartment"

View File

@ -0,0 +1,10 @@
overblog_graphql:
definitions:
schema:
query: Query
mappings:
types:
-
type: yaml
dir: "%kernel.project_dir%/config/graphql/types"
suffix: null

View File

@ -0,0 +1,3 @@
overblog_graphql_endpoint:
resource: "@OverblogGraphQLBundle/Resources/config/routing/graphql.yml"
prefix: api/graphql

View File

@ -26,3 +26,4 @@ services:
# add more service definitions when explicit configuration is needed # add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones # please note that last definitions always *replace* previous ones
Doctrine\ORM\EntityManager: "@doctrine.orm.default_entity_manager"

View 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',
];
}
}

View File

@ -90,12 +90,12 @@
"doctrine/reflection": { "doctrine/reflection": {
"version": "v1.0.0" "version": "v1.0.0"
}, },
"doctrine/sql-formatter": {
"version": "1.1.1"
},
"egulias/email-validator": { "egulias/email-validator": {
"version": "2.1.15" "version": "2.1.15"
}, },
"exsyst/swagger": {
"version": "v0.4.1"
},
"friendsofsymfony/rest-bundle": { "friendsofsymfony/rest-bundle": {
"version": "2.2", "version": "2.2",
"recipe": { "recipe": {
@ -170,6 +170,15 @@
"config/packages/prod/jms_serializer.yaml" "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": { "liip/test-fixtures-bundle": {
"version": "1.8.0" "version": "1.8.0"
}, },
@ -207,6 +216,20 @@
"ocramius/proxy-manager": { "ocramius/proxy-manager": {
"version": "2.2.3" "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": { "php": {
"version": "7.4" "version": "7.4"
}, },
@ -398,6 +421,9 @@
"symfony/polyfill-intl-idn": { "symfony/polyfill-intl-idn": {
"version": "v1.12.0" "version": "v1.12.0"
}, },
"symfony/polyfill-intl-normalizer": {
"version": "v1.20.0"
},
"symfony/polyfill-mbstring": { "symfony/polyfill-mbstring": {
"version": "v1.12.0" "version": "v1.12.0"
}, },
@ -527,9 +553,15 @@
"twig/twig": { "twig/twig": {
"version": "v2.12.3" "version": "v2.12.3"
}, },
"webimpress/safe-writer": {
"version": "2.1.0"
},
"webmozart/assert": { "webmozart/assert": {
"version": "1.5.0" "version": "1.5.0"
}, },
"webonyx/graphql-php": {
"version": "v0.13.9"
},
"willdurand/jsonp-callback-validator": { "willdurand/jsonp-callback-validator": {
"version": "v1.1.0" "version": "v1.1.0"
}, },

View File

@ -10,7 +10,7 @@
<i class="fa fa-home"></i> <i class="fa fa-home"></i>
<img src="{{ WEBSITE_LOGO }}" alt="logo"> <img src="{{ WEBSITE_LOGO }}" alt="logo">
{{ WEBSITE_NAME }} {{ WEBSITE_NAME }}
</a> </a>
</li> </li>
</ul> </ul>