symfony/demo

Use DTOs to map requests (using MapRequestPayload & MapQueryString)

BafS opened this issue · 10 comments

BafS commented

The demo is a good place to show the best practices. Now that we have the new attributes to map requests to DTOs (MapRequestPayload & MapQueryString) I think it would be great to use them in the demo. It would also help to see some potential issues we can hit using those (there are some open issues related to that).

If you think we should not, feel free to close this issue.

94noni commented

I like the idea on my side
there were already a pass on using attributes, this can also showcase some nice new usage :)

I'm not sure about making this change.

The reason is that I don't know how popular is this technique among Symfony developers.

I fear that newcomers see it and think that Symfony is more complex/cumbersome than it really is.

Maybe we could do it only in one controller and clearly explain that "all this complication" is totally optional. It's nice for complex apps that will be maintained in the future, but it's overkill for other simpler apps.

BafS commented

@javiereguiluz thanks for your feedback. Valid point for sure. In the other hand, doing it in the demo could also help devs to make the move.

If we were to do it partially (which I think is a good idea), what would you choose? Maybe the admin part could be a good contender.

BafS commented

What would be the way to move forward @javiereguiluz? Is the PR fine for you?

BafS commented

Any new about this issue? The PR is open since October

BafS commented

It's been 6 months, any chance? Shall I just close it?

@BafS sorry for not having made a decision earlier. The problem I see here is that this is a fantastic Symfony feature ... but in this Symfony Demo project it looks more cumbersome than useful. The feature doesn't shine at all ... probably because the Symfony Demo app is very simple by design.

So, let's close this for now as "won't fix" ... and we can revisit this in the future. I'm sorry your proposal didn't make it this time.

BafS commented

Could we have another demo for "API" purpose? Or a new "API" module? Symfony is often use for Rest APIs but the demo doesn't really show this because it uses the "fullstack" version of Symfony.

@BafS I think it would be nice to have an API-only demo ... but:

  • I don't think we can do that ourselves (i.e. the Symfony company) because we don't have resources to create another demo project and we're not true experts in APIs;
  • Given that the API Platform project exists and it's very popular to build APIs with Symfony, maybe we can link to their demo project somewhere to guide newcomers to it.

What do you think?

BafS commented

@javiereguiluz It makes sense. My feeling is that having an API module would be the best of both worlds. It would not be a new project but yes it would take a bit more resources (it should be fairly stable once it's set and it could be a single controller) and API platform would still make sense to go deeper. It would also allow Symfony devs to do some more realistic tests on the demo.