Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- acme_api_register:
- pattern: /user
- defaults: { _controller: AcmeApiBundle:User:post, _format: json }
- requirements:
- _method: POST
- <?php
- namespace AcmeApiBundleController;
- use AcmeApiBundleEntityPatient;
- use AcmeApiBundleEntityUser;
- use SymfonyBundleFrameworkBundleControllerController;
- use SymfonyComponentHttpFoundationRequest;
- use SymfonyComponentHttpFoundationResponse;
- use FOSRestBundleControllerAnnotationsView;
- //use FOSRestBundleViewView;
- class UserController extends Controller
- {
- /**
- * @View()
- */
- public function postAction()
- {
- $user = new Patient();
- $user->setName("Daniel");
- $user->setLastName("My lastName");
- $user->setEmail("pleasework@gmail.com");
- return $user;
- }
- }
- sensio_framework_extra:
- view: { annotations: false}
- router: { annotations: true }
- fos_rest:
- format_listener:
- rules:
- - prefer_extension: false
- routing_loader:
- default_format: json
- view:
- view_response_listener: force
- {
- "name": "symfony/framework-standard-edition",
- "license": "MIT",
- "type": "project",
- "description": "The "Symfony Standard Edition" distribution",
- "autoload": {
- "psr-0": { "": "src/" }
- },
- "require": {
- "php": ">=5.3.3",
- "symfony/symfony": "~2.4",
- "doctrine/orm": "~2.2,>=2.2.3",
- "doctrine/doctrine-bundle": "~1.2",
- "twig/extensions": "~1.0",
- "symfony/assetic-bundle": "~2.3",
- "symfony/swiftmailer-bundle": "~2.3",
- "symfony/monolog-bundle": "~2.4",
- "sensio/distribution-bundle": "~2.3",
- "sensio/framework-extra-bundle": "~3.0",
- "sensio/generator-bundle": "~2.3",
- "incenteev/composer-parameter-handler": "~2.0",
- "friendsofsymfony/rest-bundle": "1.1.*",
- "jms/serializer-bundle": "0.13.*"
- },
- "scripts": {
- "post-install-cmd": [
- "Incenteev\ParameterHandler\ScriptHandler::buildParameters",
- "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
- "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
- "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
- "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile"
- ],
- "post-update-cmd": [
- "Incenteev\ParameterHandler\ScriptHandler::buildParameters",
- "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
- "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
- "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
- "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile"
- ]
- },
- "config": {
- "bin-dir": "bin"
- },
- "extra": {
- "symfony-app-dir": "app",
- "symfony-web-dir": "web",
- "symfony-assets-install": "symlink",
- "incenteev-parameters": {
- "file": "app/config/parameters.yml"
- },
- "branch-alias": {
- "dev-master": "2.4-dev"
- }
- }
- }
- Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
- fos_rest:
- param_fetcher_listener: true
- format_listener:
- rules:
- fallback_format: json
- prefer_extension: false
- priorities: [json, xml]
- view:
- view_response_listener: force
- formats:
- json: true
- xml: true
- jsonp: false
- rss: false
- html: false
- failed_validation: HTTP_BAD_REQUEST
- <?php
- namespace AcmeApiBundleController;
- use AcmeApiBundleEntityPatient;
- use AcmeApiBundleEntityUser;
- use SymfonyComponentHttpFoundationRequest;
- use SymfonyComponentHttpFoundationResponse;
- use FOSRestBundleControllerAnnotationsView;
- use FOSRestBundleControllerFOSRestController;
- class UserController extends FOSRestController
- {
- /**
- * @View()
- */
- public function postUserAction()
- {
- $user = new Patient();
- $user->setName("Daniel");
- $user->setLastName("My lastName");
- $user->setEmail("pleasework@gmail.com");
- return $user;
- }
- }
- users:
- type: rest
- resource: AcmeApiBundleControllerUsersController
- #...
- fos_rest:
- view:
- view_response_listener: force
- format_listener:
- default_priorities: ['json', 'html', '*/*']
- fallback_format: json
- prefer_extension: true
- #...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement