symfony - Get the key name of an array in twig -
I have this array of values for printing in the table
array (4) {["Ayel.bokbok"] = & gt; Array (1) {[/ "/ ap_dev.php/index/"]=> Int (2)} ["ryhel1120"] = & gt; Array (2) {[/ "/ ap_dev.php/index/"]=> Int (47) ["/app_dev.php/users/"]=> Int (84)} ["ariel.alvarez"] = & gt; Array (1) {[/ / app_dev.php/users/"]=> Int (3)} ["ReutersSercic 23"] = & gt; Array (3) {[/ / asap_local.php/admin/analytics"]=> Int (338) ["/app_local.php/index/"]=> Int (7) ["/app_local.php/users/"]=> Int (13)} How can I print ayel.bokbok in this code because in this code {% key, value in foo %} This index prints and not the key name of the key. @ PCCest is that {{dump (array)}} prints in print: array (1) {
[0 ] = & Gt; Array (4)
{[ariel.alvarez "] => array (2) {[/ / app_dev.php/index/"]=>int (1) [" /app_dev.php/users/"]=> Int (3)} ["ayel.bokbok"] = & gt; array (1) {[/ "/app_dev.php/index/"]=> Int (4 )} ["Ryhel1120"] = & gt; array (2) {["/app_dev.php/index/"]=> int (58) [" /app_dev.php/users/"]=> Int ( 121)} ["reenterscracic 23"] = & gt; array (3) {[/app_local.php/admin/analytics"]=> int (312) ["/app_local.php/index/"]=> ; Int (7) ["/app_local.php/users/"]=> this is the code from the controller: foo \ BarBundle \ controller? Int (8 )}}}} ; Use Symfony \ Bundle \ FrameworkBundle \ Controller \ Controller; Class Analytics Controller Controller {Public Funk Action Index Action () {$ Gapi = $ this-> Get Container-> ('bti_rep_sys.gapiManager') - & gt; GapiGetOverview (); $ Gapifiltered = $ this- & gt; Container-> gt; ; Receive ('bti_rep_sys.gapiManager') - & gt; GapiGetFilter (); $ $ --- ($ fooBarBundle: analytics: index.html.twig '), array (' gatidata '= & gt; $ Gapi, 'gatidatafilter' = & gt; $ Gapifiltered) Return; }}
This is my code for index.html.twig:
{% "fooBarBundle :: layout.html.twig"%} Expands {% Block Entity {%} {% "Includes: Phrasebundal: Analytics: GoogleCharts.js.twig"%} <1H1> Analytics reports & lt; / H1> & Lt; Div class = "row" & gt; & Lt; Div class = "float-left" id = "chart_div_bar" & gt; & Lt; / Div & gt; & Lt; Div class = "float-right" id = "chart_div_pie" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "right-align" & gt; (Updated as {{"now" | Date ('D / M / Y')}}) & lt; / Div & gt; {% Dump (gapidatafiltered)}} {% endblock%}
If you are trying to get the string /app_dev.php/index/ then this might be a trick {% for the route, the path foo %} {% {Keys} keys for path path} {{path}} {% endfor%} {% endfor%}
Comments
Post a Comment