r/symfony No Stupid Questions Thread – 15/04/20 – 21/04/20

Ok, so I'm borrowing the thread idea from the r/laravel subreddit:

You've got a tiny question about Symfony which you're too embarrassed to make a whole post about, or maybe you've just started a new job and something simple is tripping you up. Share it here in the weekly judgement-free no stupid questions thread.

4 thoughts on “r/symfony No Stupid Questions Thread – 15/04/20 – 21/04/20”

  1. Oh this is a brilliant idea, but I feel embarassed even on a embarassement-free post. I have so many questions. I’m newbie and currently learning php/oop/web/symfony 5.

    Ok let’s start with one : If you develop very different parts in your website (for example, you made a news site and you have a handmade forum), do you use the bundle system from symfony 2/3 (don’t remember when this was central) or now there is a newer way to organize things ?

    Thank you !

    Reply
  2. I’m rebuilding a supervision app.I have controllers that manage only one type of entity with actions associated for them.

    For example:

    /** @Route(“/product”) */
    class ProductController extends AbstractController {
    /** @Route(“/”, name=”app_product_list”) */
    public function list() {…}
    /** @Route(“/{productId<\d+>}”, name=”app_product_view”) */
    public function view(Product $product) {…}
    /** @Route(“/{productId<\d+>}/print”, name=”app_product_print”) */
    public function print(Product $product) {…}
    }

    Is there a way that inside my “view” template I can create a link to “print” like this:

    {{ path(‘app_product_print’) }}

    instead of like this:

    {{ path(‘app_product_print’, {productId: product.productId}) }}

    EDITS: formatting code.

    EDIT again : forget to mention version => Symfony 4.4 LTS

    Reply
  3. What would be a good example of Symfony Service?
    I’m studying Symfony, i’m really enjoying it, but i can’t get my head wrapped around a good use case for a service.

    Maybe it’s a little bit stupid, but for me it’s not trivial.

    Thanks!

    Reply
  4. GraphQL question. Say you have users entity and you want to access one with id=1 via graphQL. Why does graphQL want the query to look like this:

    {
    user(id:”/api/users/5″) {
    id
    }

    Can I make it so that I can enter a simple integer ‘5’ in the id parameter?

    Reply

Leave a Comment