如何从请求symfony2获取参数

如何从请求symfony2获取参数,symfony,request,twig,dump,Symfony,Request,Twig,Dump,我可以给你一部分请求转储: {{dump(请求)}}: -route: "userBuyerProductRequestGetAll" -params: array:3 [ "productRequestId" => null "sort" => "p.name" "direction" => "asc" ] -pageRange: 9 -template: "dsarhoyaSCBundle:Layout:paginator.html

我可以给你一部分请求转储:

{{dump(请求)}}

 -route: "userBuyerProductRequestGetAll"
  -params: array:3 [
    "productRequestId" => null
    "sort" => "p.name"
    "direction" => "asc"
  ]
  -pageRange: 9
  -template: "dsarhoyaSCBundle:Layout:paginator.html.twig"
  -sortableTemplate: "dsarhoyaSCBundle:Layout:sortable_link.html.twig"
  -filtrationTemplate: "KnpPaginatorBundle:Pagination:filtration.html.twig"
  -extraViewParams: []
  #currentPageNumber: 1
  #numItemsPerPage: 20
  #items: array:20 [
    0 => ProductRequest {#1528
      -id: 165
      -originalRequestId: null
      -originalRequestDate: null
      -creationTime: DateTime {#1521
        +"date": "2015-11-12 12:29:49"
        +"timezone_type": 3
        +"timezone": "America/Santiago"
      }
      -quantity: "1.00"
      -dimension: null
      -brand: null
      -model: null
      -origin: null
      -requiresExample: null
      -processSuggestion: null
      -lastValidatedStep: 1
      -correlative: 5
      -deletedAt: null
      -assignedQuantity: "0.00"
      -status: "pending"
      -comments: "ASD"
      -unit: CompanyUnit {#452
        +__isInitialized__: true
        -id: 3
        -name: "agua-salada" <-- i need this

这是可行的,但不是最好的解决办法

也许这就是你想要的:

{{ app.request.get('name') }}

你的问题不够精确,
name
var到底是什么?请看我最近的评论它在哪里?
{{ app.request.get('name') }}