Advertisement
Guest User

Untitled

a guest
Nov 26th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.66 KB | None | 0 0
  1. imports:
  2. - { resource: parameters.yml }
  3. - { resource: security.yml }
  4. - { resource: services.yml }
  5. - { resource: "@UserBundle/Resources/config/services.yml" }
  6.  
  7. # Put parameters here that don't need to change on each machine where the app is deployed
  8. # http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
  9. parameters:
  10. locale: fr
  11.  
  12. framework:
  13. #esi: ~
  14. translator: ~
  15. secret: "%secret%"
  16. router:
  17. resource: "%kernel.root_dir%/config/routing.yml"
  18. strict_requirements: ~
  19. form: ~
  20. csrf_protection: ~
  21. validation: { enable_annotations: true }
  22. #serializer: { enable_annotations: true }
  23. templating:
  24. engines: ['twig']
  25. default_locale: "%locale%"
  26. trusted_hosts: ~
  27. trusted_proxies: ~
  28. session:
  29. # handler_id set to null will use default session handler from php.ini
  30. handler_id: ~
  31. fragments: ~
  32. http_method_override: true
  33.  
  34. # Twig Configuration
  35. twig:
  36. debug: "%kernel.debug%"
  37. strict_variables: "%kernel.debug%"
  38.  
  39. # Doctrine Configuration
  40. doctrine:
  41. dbal:
  42. driver: pdo_mysql
  43. host: "%database_host%"
  44. port: "%database_port%"
  45. dbname: "%database_name%"
  46. user: "%database_user%"
  47. password: "%database_password%"
  48. charset: UTF8
  49. # if using pdo_sqlite as your database driver:
  50. # 1. add the path in parameters.yml
  51. # e.g. database_path: "%kernel.root_dir%/data/data.db3"
  52. # 2. Uncomment database_path in parameters.yml.dist
  53. # 3. Uncomment next line:
  54. # path: "%database_path%"
  55.  
  56. orm:
  57. auto_generate_proxy_classes: "%kernel.debug%"
  58. naming_strategy: doctrine.orm.naming_strategy.underscore
  59. auto_mapping: true
  60.  
  61. # Swiftmailer Configuration
  62. swiftmailer:
  63. transport: "%mailer_transport%"
  64. host: "%mailer_host%"
  65. username: "%mailer_user%"
  66. password: "%mailer_password%"
  67. spool: { type: memory }
  68.  
  69. fos_user:
  70. db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
  71. firewall_name: main
  72. user_class: testUserBundleEntityUser
  73.  
  74. fos_rest:
  75. view:
  76. view_response_listener: 'force'
  77. formats:
  78. json: true
  79. format_listener:
  80. rules:
  81. - { path: '^/api', priorities: ['json'], fallback_format: json, prefer_extension: true }
  82. - { path: '^/', stop: true }
  83.  
  84. nelmio_cors:
  85. paths:
  86. '^/api/':
  87. allow_credentials: true
  88. allow_origin: ['*']
  89. allow_headers: ['*']
  90. allow_methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']
  91. max_age: 3600
  92.  
  93. user:
  94. resource: "@UserBundle/Resources/config/routing.yml"
  95. prefix: /
  96.  
  97. med:
  98. resource: "@MedBundle/Resources/config/routing.yml"
  99. prefix: /
  100.  
  101. app:
  102. resource: "@AppBundle/Controller/"
  103. type: annotation
  104.  
  105. fos_user:
  106. resource: "@FOSUserBundle/Resources/config/routing/all.xml"
  107.  
  108. NelmioApiDocBundle:
  109. resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
  110. prefix: /api/doc
  111.  
  112. app_api:
  113. resource: "@MedBundle/Resources/config/routing_rest.yml"
  114. type: rest
  115. prefix: /api
  116.  
  117. api_app:
  118. resource: MedBundleControllerApiAppController
  119. type: rest
  120.  
  121. <?php
  122.  
  123. namespace testMedBundleControllerApi;
  124.  
  125. use SensioBundleFrameworkExtraBundleConfigurationRoute;
  126. use SymfonyComponentHttpFoundationRequest;
  127. use SymfonyBundleFrameworkBundleControllerController;
  128. use FOSRestBundleControllerAnnotationsRouteResource;
  129.  
  130.  
  131.  
  132. /**
  133. * @RouteResource("User")
  134. */
  135. Class AppController extends Controller {
  136.  
  137. public function getAction() {
  138. $em = $this->getDoctrine()->getManager();
  139. $test = $em->getRepository('MedBundle:Apps')->findAll();
  140. return array("test" => $test);
  141. }
  142.  
  143.  
  144. public function postAction(Request $request){
  145.  
  146. return $request->request->all();
  147.  
  148. }
  149.  
  150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement