Questions tagged [fosrestbundle]

A Symfony 2 plugin by FriendsOfSymfony (FOS) which provides various tools to rapidly develop RESTful API's with Symfony 2.

A Symfony 2 bundle by FriendsOfSymfony (FOS) which provides various tools to rapidly developer RESTful API's with Symfony 2.

Its features include:

  • A View layer to enable output and format agnostic Controllers
  • A custom route loader to generate url's following REST conventions
  • Accept header format negotiation including handling for custom mime types
  • RESTful decoding of HTTP request body and Accept headers
  • Exception controller for sending appropriate HTTP status codes

Links:

803 questions
3
votes
4 answers

Groups Annotations don't works

Symfony 3.1.7 + FOSRestBundle latest version
doums
  • 470
  • 10
  • 24
3
votes
2 answers

handling the The CSRF token in symfony's forms when in public REST context

I'm developer my first symfony (3) app. it is a REST service publicly accessible. I'm doing this using FOSRestBundle. I'll have to ad some admin forms soon or later, and I'll probably want to create them directly (without passing by the extra work…
Bruno
  • 1,088
  • 1
  • 13
  • 31
3
votes
0 answers

Symfony 3 populate anonymous token sometimes

Don't know why it doing that but sometimes it seems Symfony 3 losing my current user, depending on which route I'm calling. [2016-11-19 17:35:26] request.INFO: Matched route "webapi_get_payment_method".…
blackarcanis
  • 542
  • 1
  • 4
  • 23
3
votes
2 answers

FosRestBundle PATCH action prevent update entity with null/default values

I have made a working patchAction on my serverController to update one or some field in a existent server. Actually my patchAction look like this /* * @ParamConverter("updatedServer", converter="fos_rest.request_body") * * @return View */ public…
Jérôme
  • 1,966
  • 4
  • 24
  • 48
3
votes
1 answer

FosRestBundle PATCH action + entity field with NotBlank constraint

I have a Dns entity who have a content field with a NotBlank constraint /** * @var int * * @ORM\Column(name="id", type="integer", nullable=false) * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") */ private $id; /** * @var string * *…
Jérôme
  • 1,966
  • 4
  • 24
  • 48
3
votes
2 answers

Invalid Form in Symfony with no errors

This is the first time I've tried to use forms with Symfony, and I've got myself completely stuck. I'm sure it will be something simple. I have a simple controller set up as so (using Symfony 2.7 and FOSRestBundle 2.0): /** * @View() */ public…
Andy Raines
  • 297
  • 1
  • 3
  • 9
3
votes
1 answer

Symfony2 FOSRestBundle handleView() doesn't work

Just created a new project with symfony2 and installed FOSRestBundle. Controller example:
Supervision
  • 1,683
  • 1
  • 18
  • 23
3
votes
1 answer

FOSRestBundle Catching All Routes

I'm trying to integrate FOSRestBundle into my application. I want to use it only when a route matches like ^/api. I really don't know how to use this bundle, and i think the documentation is pretty bad. (No offense). fos_rest: format_listener: …
Canser Yanbakan
  • 3,780
  • 3
  • 39
  • 65
3
votes
1 answer

Symfony Assert DateTime JMSSerializer

I have endpoint postOrder - create entity order. In entity order I have fields with type DateTime and I want when somebody write string instead DateTime I have "Not valid, should be DateTime" . For other fields I use like this *…
shuba.ivan
  • 3,824
  • 8
  • 49
  • 121
3
votes
1 answer

Unable to replace alias "templating" with "fos_rest.templating"

I'm trying to setup Symfony3 microkelner to work with FOSRestBundle and I've faced some issues with it. I want to use as input json or xml and as output also json or xml. I've did some setup and I face errors: InvalidArgumentException in…
Robert
  • 19,800
  • 5
  • 55
  • 85
3
votes
1 answer

How to expose a property of related object in serializer configuration in Symfony 2?

I use FOSRestBundle with JMSSerializerBundle in my web service. Here is a function in my action controller that returns a list of roles. I don't know how to return a "parent_id" field in this list.
Ildar
  • 3,808
  • 7
  • 45
  • 81
3
votes
1 answer

Symfony2 Form Validation Error Returning HTTP Code '200'

Upon submitting an invalid form via HTTP POST, I expect my Symfony REST service (using FOSRestBundle) to return a 400 Bad Request code. Instead, it is returning 200 OK even though it is returning the errors in JSON format like I want. Within my…
Ravioli87
  • 795
  • 13
  • 34
3
votes
1 answer

Saving ManyToOne-Relationships with Symfony an FOSRestBundle

I'm using symfony with FOSRestBundle for my project. I made this example out of my code to reduce complexity. maybe forgot to rename a variable. I have problems saving a article that has ONE category. the categories are already existing in the…
MontyBurns
  • 89
  • 2
  • 9
3
votes
1 answer

FOSRestBundle and JMSSerializer custom form error handler

I have written a custom Form Handler for JMSSerializerBundle that I'm using with FOSRestBundle. According to the documentation it should be as easy as tagging a service correctly. But my custom handler never gets used. Here's the…
Squeegy
  • 869
  • 9
  • 20
3
votes
1 answer

FosRestBundle Route generation with CamelCase class

I have a slight Problem with on of my Controllers. The Entity the api is for is called: MyEntity so naturally the controller is called: MyEntityController If I now define an action: public function getMyEntity($id) the route that is generated is…
gries
  • 1,135
  • 6
  • 29