Add api platform

pull/3262/head
Julio Montoya 6 years ago
parent 58062bfb94
commit 664a5394ac
  1. 3
      composer.json
  2. 2
      config/bundles.php
  3. 7
      config/packages/api_platform.yaml
  4. 1
      config/packages/framework.yaml
  5. 10
      config/packages/nelmio_cors.yaml
  6. 8
      config/routes.yaml
  7. 4
      config/routes/api_platform.yaml
  8. 58
      config/routes/sonata_api.yaml

@ -160,7 +160,8 @@
"tgalopin/html-sanitizer-bundle": "^1.1",
"twig/extensions": "^1.5",
"vich/uploader-bundle": "^1.13",
"webit/eval-math": "~1.0"
"webit/eval-math": "~1.0",
"api-platform/api-pack": "^1.2"
},
"config": {
"component-dir": "public/assets"

@ -72,4 +72,6 @@ return [
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
];

@ -0,0 +1,7 @@
api_platform:
mapping:
paths: ['%kernel.project_dir%/src/CoreBundle/Entity', '%kernel.project_dir%/src/CourseBundle/Entity']
patch_formats:
json: ['application/merge-patch+json']
swagger:
versions: [3]

@ -17,3 +17,4 @@ framework:
annotations:
cache: file
file_cache_dir: "%kernel.cache_dir%/annotations"
serializer: { enable_annotations: true }

@ -0,0 +1,10 @@
nelmio_cors:
defaults:
origin_regex: true
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
allow_headers: ['Content-Type', 'Authorization']
expose_headers: ['Link']
max_age: 3600
paths:
'^/': null

@ -22,10 +22,10 @@ oneup_uploader:
resource: .
type: uploader
resources:
type: rest
prefix: /api/{tool}/{type}
resource: Chamilo\CoreBundle\Controller\ResourceApiController
#resources:
# type: rest
# prefix: /api/{tool}/{type}
# resource: Chamilo\CoreBundle\Controller\ResourceApiController
# Resources

@ -0,0 +1,4 @@
api_platform:
resource: .
type: api_platform
prefix: /api

@ -1,58 +0,0 @@
#NelmioApiDocBundle:
# resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
# prefix: /doc
#sonata_api_classification:
# type: rest
# prefix: /classification
# resource: "@SonataClassificationBundle/Resources/config/routing/api.xml"
#
#sonata_api_news:
# type: rest
# prefix: /news
# resource: "@SonataNewsBundle/Resources/config/routing/api.xml"
#
#sonata_api_media:
# type: rest
# prefix: /media
# resource: "@SonataMediaBundle/Resources/config/routing/api.xml"
#
#sonata_api_notification:
# type: rest
# prefix: /notification
# resource: "@SonataNotificationBundle/Resources/config/routing/api.xml"
#sonata_api_ecommerce_product:
# type: rest
# prefix: /ecommerce
# resource: "@SonataProductBundle/Resources/config/routing/api.xml"
#
#sonata_api_ecommerce_order:
# type: rest
# prefix: /ecommerce
# resource: "@SonataOrderBundle/Resources/config/routing/api.xml"
#
#sonata_api_ecommerce_invoice:
# type: rest
# prefix: /ecommerce
# resource: "@SonataInvoiceBundle/Resources/config/routing/api.xml"
#
#sonata_api_ecommerce_customer:
# type: rest
# prefix: /ecommerce
# resource: "@SonataCustomerBundle/Resources/config/routing/api.xml"
#
#sonata_api_ecommerce_basket:
# type: rest
# prefix: /ecommerce
# resource: "@SonataBasketBundle/Resources/config/routing/api.xml"
#
#sonata_api_page:
# type: rest
# prefix: /page
# resource: "@SonataPageBundle/Resources/config/routing/api.xml"
#
#sonata_api_user:
# type: rest
# prefix: /user
# resource: "@SonataUserBundle/Resources/config/routing/api.xml"
Loading…
Cancel
Save