Moving ApiBundle\GraphQL to GraphQlBundle #2644

pull/2818/head
Angel Fernando Quiroz Campos 6 years ago
parent 2230c83cbc
commit 14a5208240
  1. 2
      config/bundles.php
  2. 38
      config/packages/graphql.yaml
  3. 2
      config/routes/chamilo.yaml
  4. 7
      src/GraphQlBundle/ChamiloGraphQlBundle.php
  5. 8
      src/GraphQlBundle/Controller/GraphQlController.php
  6. 10
      src/GraphQlBundle/Map/EnumMap.php
  7. 10
      src/GraphQlBundle/Map/MutationMap.php
  8. 36
      src/GraphQlBundle/Map/QueryMap.php
  9. 10
      src/GraphQlBundle/Map/ScalarMap.php
  10. 8
      src/GraphQlBundle/Map/UnionMap.php
  11. 8
      src/GraphQlBundle/Resolver/CourseResolver.php
  12. 8
      src/GraphQlBundle/Resolver/SessionResolver.php
  13. 8
      src/GraphQlBundle/Resolver/UserResolver.php
  14. 2
      src/GraphQlBundle/Resources/config/routing.yaml
  15. 0
      src/GraphQlBundle/Resources/config/schema.types.graphql
  16. 8
      src/GraphQlBundle/Traits/GraphQLTrait.php

@ -54,7 +54,7 @@ return [
Chamilo\NotificationBundle\ChamiloNotificationBundle::class => ['all' => true],
Chamilo\SettingsBundle\ChamiloSettingsBundle::class => ['all' => true],
Chamilo\TimelineBundle\ChamiloTimelineBundle::class => ['all' => true],
Chamilo\ApiBundle\ChamiloApiBundle::class => ['all' => true],
Chamilo\GraphQlBundle\ChamiloGraphQlBundle::class => ['all' => true],
Chamilo\LtiBundle\ChamiloLtiBundle::class => ['all' => true],
winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class => ['all' => true],
Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle::class => ['all' => true],

@ -4,38 +4,38 @@ overblog_graphql:
query: Query
mutation: Mutation
resolver_maps:
- '%chamilo_api.graphql.resolver_map.query.class%'
- '%chamilo_api.graphql.resolver_map.enum.class%'
- '%chamilo_api.graphql.resolver_map.union.class%'
- '%chamilo_api.graphql.resolver_map.scalar.class%'
- '%chamilo_api.graphql.resolver_map.mutation.class%'
- '%chamilo_graphql.resolver_map.query.class%'
- '%chamilo_graphql.resolver_map.enum.class%'
- '%chamilo_graphql.resolver_map.union.class%'
- '%chamilo_graphql.resolver_map.scalar.class%'
- '%chamilo_graphql.resolver_map.mutation.class%'
mappings:
types:
-
type: graphql
dir: "%kernel.root_dir%/ApiBundle/GraphQL/Resources/config"
dir: "%kernel.root_dir%/GraphQlBundle/Resources/config"
parameters:
chamilo_api.graphql.resolver_map.query.class: Chamilo\ApiBundle\GraphQL\Map\QueryMap
chamilo_api.graphql.resolver_map.enum.class: Chamilo\ApiBundle\GraphQL\Map\EnumMap
chamilo_api.graphql.resolver_map.union.class: Chamilo\ApiBundle\GraphQL\Map\UnionMap
chamilo_api.graphql.resolver_map.scalar.class: Chamilo\ApiBundle\GraphQL\Map\ScalarMap
chamilo_api.graphql.resolver_map.mutation.class: Chamilo\ApiBundle\GraphQL\Map\MutationMap
chamilo_graphql.resolver_map.query.class: Chamilo\GraphQlBundle\Map\QueryMap
chamilo_graphql.resolver_map.enum.class: Chamilo\GraphQlBundle\Map\EnumMap
chamilo_graphql.resolver_map.union.class: Chamilo\GraphQlBundle\Map\UnionMap
chamilo_graphql.resolver_map.scalar.class: Chamilo\GraphQlBundle\Map\ScalarMap
chamilo_graphql.resolver_map.mutation.class: Chamilo\GraphQlBundle\Map\MutationMap
services:
chamilo_api.graphql.resolver.user:
class: Chamilo\ApiBundle\GraphQL\Resolver\UserResolver
chamilo_graphql.resolver.user:
class: Chamilo\GraphQlBundle\Resolver\UserResolver
arguments: ['@service_container']
chamilo_api.graphql.resolver.course:
class: Chamilo\ApiBundle\GraphQL\Resolver\CourseResolver
chamilo_graphql.resolver.course:
class: Chamilo\GraphQlBundle\Resolver\CourseResolver
arguments: ['@service_container']
chamilo_api.graphql.resolver.session:
class: Chamilo\ApiBundle\GraphQL\Resolver\SessionResolver
chamilo_graphql.resolver.session:
class: Chamilo\GraphQlBundle\Resolver\SessionResolver
arguments: ['@service_container']
Chamilo\ApiBundle\GraphQL\Map\:
resource: "../../src/ApiBundle/GraphQL/Map/*"
Chamilo\GraphQlBundle\Map\:
resource: "../../src/GraphQlBundle/Map/*"
arguments:
- "@service_container"

@ -27,7 +27,7 @@ chamilo_faq:
resource: "@ChamiloFaqBundle/Resources/config/routing.yml"
chamilo_graphql:
resource: "@ChamiloApiBundle/GraphQL/Resources/config/routing.yaml"
resource: "@ChamiloGraphQlBundle/Resources/config/routing.yaml"
chamilo_lti:
resource: "@ChamiloLtiBundle/Resources/config/routing.yml"

@ -1,15 +1,16 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle;
namespace Chamilo\GraphQlBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Class ChamiloApiBundle.
* Class ChamiloGraphQlBundle.
*
* @package Chamilo\ApiBundle
*/
class ChamiloApiBundle extends Bundle
class ChamiloGraphQlBundle extends Bundle
{
}

@ -1,7 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle\GraphQL\Controller;
namespace Chamilo\GraphQlBundle\Controller;
use Chamilo\UserBundle\Entity\User;
use Firebase\JWT\JWT;
@ -12,11 +12,11 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
/**
* Class ApiController.
* Class GraphQlController.
*
* @package Chamilo\ApiBundle\GraphQL\Controller
* @package Chamilo\GraphQlBundle\Controller
*/
class ApiController extends AbstractController
class GraphQlController extends AbstractController
{
/**
* @Route("/learnpath/view", name="chamilo_graphql_learnpath")

@ -1,21 +1,21 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle\GraphQL\Map;
namespace Chamilo\GraphQlBundle\Map;
use Chamilo\ApiBundle\GraphQL\ApiGraphQLTrait;
use Chamilo\GraphQlBundle\Traits\GraphQLTrait;
use Chamilo\UserBundle\Entity\User;
use Overblog\GraphQLBundle\Resolver\ResolverMap;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
/**
* Class EnumResolverMap.
* Class EnumMap.
*
* @package Chamilo\ApiBundle\GraphQL\Map
* @package Chamilo\GraphQlBundle\Map
*/
class EnumMap extends ResolverMap implements ContainerAwareInterface
{
use ApiGraphQLTrait;
use GraphQLTrait;
/**
* @return array

@ -1,9 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle\GraphQL\Map;
namespace Chamilo\GraphQlBundle\Map;
use Chamilo\ApiBundle\GraphQL\ApiGraphQLTrait;
use Chamilo\GraphQlBundle\Traits\GraphQLTrait;
use Chamilo\UserBundle\Entity\User;
use GraphQL\Type\Definition\ResolveInfo;
use Overblog\GraphQLBundle\Definition\Argument;
@ -12,13 +12,13 @@ use Overblog\GraphQLBundle\Resolver\ResolverMap;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
/**
* Class MutationResolverMap.
* Class MutationMap.
*
* @package Chamilo\ApiBundle\GraphQL\Map
* @package Chamilo\GraphQlBundle\Map
*/
class MutationMap extends ResolverMap implements ContainerAwareInterface
{
use ApiGraphQLTrait;
use GraphQLTrait;
/**
* @return array

@ -1,9 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle\GraphQL\Map;
namespace Chamilo\GraphQlBundle\Map;
use Chamilo\ApiBundle\GraphQL\ApiGraphQLTrait;
use Chamilo\GraphQlBundle\Traits\GraphQLTrait;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Message;
use Chamilo\CoreBundle\Entity\Session;
@ -26,11 +26,11 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
/**
* Class QueryMap.
*
* @package Chamilo\ApiBundle\GraphQL\Map
* @package Chamilo\GraphQlBundle\Map
*/
class QueryMap extends ResolverMap implements ContainerAwareInterface
{
use ApiGraphQLTrait;
use GraphQLTrait;
/**
* @return array
@ -56,7 +56,7 @@ class QueryMap extends ResolverMap implements ContainerAwareInterface
ResolveInfo $info
) {
$context->offsetSet('user', $user);
$resolver = $this->container->get('chamilo_api.graphql.resolver.user');
$resolver = $this->container->get('chamilo_graphql.resolver.user');
return $this->resolveField($info->fieldName, $user, $resolver, $args, $context);
},
@ -87,7 +87,7 @@ class QueryMap extends ResolverMap implements ContainerAwareInterface
ResolveInfo $info
) {
$context->offsetSet('course', $course);
$resolver = $this->container->get('chamilo_api.graphql.resolver.course');
$resolver = $this->container->get('chamilo_graphql.resolver.course');
return $this->resolveField($info->fieldName, $course, $resolver, $args, $context);
},
@ -100,7 +100,7 @@ class QueryMap extends ResolverMap implements ContainerAwareInterface
ResolveInfo $info
) {
if ('descriptions' === $info->fieldName) {
$resolver = $this->container->get('chamilo_api.graphql.resolver.course');
$resolver = $this->container->get('chamilo_graphql.resolver.course');
return $resolver->getDescriptions($tool, $context);
}
@ -116,7 +116,7 @@ class QueryMap extends ResolverMap implements ContainerAwareInterface
\ArrayObject $context,
ResolveInfo $info
) {
$resolver = $this->container->get('chamilo_api.graphql.resolver.course');
$resolver = $this->container->get('chamilo_graphql.resolver.course');
if ('announcements' === $info->fieldName) {
return $resolver->getAnnouncements($tool, $context);
@ -154,7 +154,7 @@ class QueryMap extends ResolverMap implements ContainerAwareInterface
ResolveInfo $info
) {
if ('notes' === $info->fieldName) {
$resolver = $this->container->get('chamilo_api.graphql.resolver.course');
$resolver = $this->container->get('chamilo_graphql.resolver.course');
return $resolver->getNotes($context);
}
@ -174,7 +174,7 @@ class QueryMap extends ResolverMap implements ContainerAwareInterface
\ArrayObject $context,
ResolveInfo $info
) {
$resolver = $this->container->get('chamilo_api.graphql.resolver.course');
$resolver = $this->container->get('chamilo_graphql.resolver.course');
if ('categories' === $info->fieldName) {
return $resolver->getForumCategories($context);
@ -202,7 +202,7 @@ class QueryMap extends ResolverMap implements ContainerAwareInterface
return $category->getCatComment();
},
'forums' => function (CForumCategory $category, Argument $args, \ArrayObject $context) {
$resolver = $this->container->get('chamilo_api.graphql.resolver.course');
$resolver = $this->container->get('chamilo_graphql.resolver.course');
return $resolver->getForums($category, $context);
},
@ -224,7 +224,7 @@ class QueryMap extends ResolverMap implements ContainerAwareInterface
return (int) $forum->getForumPosts();
},
'threads' => function (CForumForum $forum, Argument $args, \ArrayObject $context) {
$resolver = $this->container->get('chamilo_api.graphql.resolver.course');
$resolver = $this->container->get('chamilo_graphql.resolver.course');
return $resolver->getThreads($forum, $context);
},
@ -258,7 +258,7 @@ class QueryMap extends ResolverMap implements ContainerAwareInterface
return $thread->getThreadCloseDate();
},
'posts' => function (CForumThread $thread, Argument $args, \ArrayObject $context) {
$resolver = $this->container->get('chamilo_api.graphql.resolver.course');
$resolver = $this->container->get('chamilo_graphql.resolver.course');
return $resolver->getPosts($thread, $context);
},
@ -297,7 +297,7 @@ class QueryMap extends ResolverMap implements ContainerAwareInterface
ResolveInfo $info
) {
if ('events' === $info->fieldName) {
$resolver = $this->container->get('chamilo_api.graphql.resolver.course');
$resolver = $this->container->get('chamilo_graphql.resolver.course');
return $resolver->getAgenda($context);
}
@ -321,7 +321,7 @@ class QueryMap extends ResolverMap implements ContainerAwareInterface
],
'ToolDocuments' => [
'documents' => function (CTool $tool, Argument $args, \ArrayObject $context) {
$resolver = $this->container->get('chamilo_api.graphql.resolver.course');
$resolver = $this->container->get('chamilo_graphql.resolver.course');
$dirId = !empty($args['dirId']) ? $args['dirId'] : null;
@ -331,14 +331,14 @@ class QueryMap extends ResolverMap implements ContainerAwareInterface
//'CourseDocument' => [],
'ToolLearningPath' => [
'categories' => function (CTool $tool, Argument $args, \ArrayObject $context) {
$resolver = $this->container->get('chamilo_api.graphql.resolver.course');
$resolver = $this->container->get('chamilo_graphql.resolver.course');
return $resolver->getLearnpathCategories($context);
},
],
'CourseLearnpathCategory' => [
'learnpaths' => function (CLpCategory $category, Argument $args, \ArrayObject $context) {
$resolver = $this->container->get('chamilo_api.graphql.resolver.course');
$resolver = $this->container->get('chamilo_graphql.resolver.course');
return $resolver->getLearnpathsByCategory($category, $context);
},
@ -352,7 +352,7 @@ class QueryMap extends ResolverMap implements ContainerAwareInterface
ResolveInfo $info
) {
$context->offsetSet('session', $session);
$resolver = $this->container->get('chamilo_api.graphql.resolver.session');
$resolver = $this->container->get('chamilo_graphql.resolver.session');
return $this->resolveField($info->fieldName, $session, $resolver, $args, $context);
},

@ -1,9 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle\GraphQL\Map;
namespace Chamilo\GraphQlBundle\Map;
use Chamilo\ApiBundle\GraphQL\ApiGraphQLTrait;
use Chamilo\GraphQlBundle\Traits\GraphQLTrait;
use GraphQL\Error\Error;
use GraphQL\Language\AST\Node;
use GraphQL\Language\AST\StringValueNode;
@ -11,13 +11,13 @@ use Overblog\GraphQLBundle\Resolver\ResolverMap;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
/**
* Class ScalarResolverMap.
* Class ScalarMap.
*
* @package Chamilo\ApiBundle\GraphQL\Map
* @package Chamilo\GraphQlBundle\Map
*/
class ScalarMap extends ResolverMap implements ContainerAwareInterface
{
use ApiGraphQLTrait;
use GraphQLTrait;
/**
* @return array

@ -1,9 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle\GraphQL\Map;
namespace Chamilo\GraphQlBundle\Map;
use Chamilo\ApiBundle\GraphQL\ApiGraphQLTrait;
use Chamilo\GraphQlBundle\Traits\GraphQLTrait;
use Chamilo\CourseBundle\Entity\CTool;
use Overblog\GraphQLBundle\Resolver\ResolverMap;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
@ -11,11 +11,11 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
/**
* Class UnionMap.
*
* @package Chamilo\ApiBundle\GraphQL\Map
* @package Chamilo\GraphQlBundle\Map
*/
class UnionMap extends ResolverMap implements ContainerAwareInterface
{
use ApiGraphQLTrait;
use GraphQLTrait;
/**
* @return array

@ -1,9 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle\GraphQL\Resolver;
namespace Chamilo\GraphQlBundle\Resolver;
use Chamilo\ApiBundle\GraphQL\ApiGraphQLTrait;
use Chamilo\GraphQlBundle\Traits\GraphQLTrait;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
@ -25,11 +25,11 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
/**
* Class CourseResolver.
*
* @package Chamilo\ApiBundle\GraphQL\Resolver
* @package Chamilo\GraphQlBundle\Resolver
*/
class CourseResolver implements ContainerAwareInterface
{
use ApiGraphQLTrait;
use GraphQLTrait;
/**
* @param Course $course

@ -1,9 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle\GraphQL\Resolver;
namespace Chamilo\GraphQlBundle\Resolver;
use Chamilo\ApiBundle\GraphQL\ApiGraphQLTrait;
use Chamilo\GraphQlBundle\Traits\GraphQLTrait;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\SessionRelCourse;
use Chamilo\CoreBundle\Security\Authorization\Voter\SessionVoter;
@ -12,11 +12,11 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
/**
* Class SessionResolver.
*
* @package Chamilo\ApiBundle\GraphQL\Resolver
* @package Chamilo\GraphQlBundle\Resolver
*/
class SessionResolver implements ContainerAwareInterface
{
use ApiGraphQLTrait;
use GraphQLTrait;
/**
* @param Session $session

@ -1,9 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle\GraphQL\Resolver;
namespace Chamilo\GraphQlBundle\Resolver;
use Chamilo\ApiBundle\GraphQL\ApiGraphQLTrait;
use Chamilo\GraphQlBundle\Traits\GraphQLTrait;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\UserBundle\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
@ -13,11 +13,11 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
/**
* Class UserResolver.
*
* @package Chamilo\ApiBundle\GraphQL\Resolver
* @package Chamilo\GraphQlBundle\Resolver
*/
class UserResolver implements ContainerAwareInterface
{
use ApiGraphQLTrait;
use GraphQLTrait;
/**
* @param User $user

@ -1,4 +1,4 @@
chamilo_graphql_course_learnpath:
resource: '@ChamiloApiBundle/GraphQL/Controller/ApiController.php'
resource: '@ChamiloGraphQlBundle/Controller/GraphQlController.php'
type: annotation
prefix: /graphql

@ -1,7 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ApiBundle\GraphQL;
namespace Chamilo\GraphQlBundle\Traits;
use Chamilo\SettingsBundle\Manager\SettingsManager;
use Chamilo\UserBundle\Entity\User;
@ -14,11 +14,11 @@ use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Translation\TranslatorInterface;
/**
* Trait ApiGraphQLTrait.
* Trait GraphQLTrait.
*
* @package Chamilo\ApiBundle\GraphQL
* @package Chamilo\GraphQlBundle\Traits
*/
trait ApiGraphQLTrait
trait GraphQLTrait
{
use ContainerAwareTrait;
Loading…
Cancel
Save