如何访问symfony控制器中的数组元素

时间:2016-12-23 06:55:44

标签: php doctrine

如何从控制器中的数组集访问元素。我不确定如何访问它

  ArrayCollection {#2052 ▼
    -elements: array:2 [▼
         0 => Education {#2085 ▼
           -id: 11
            -title: "aaaaaaaaaaaaa"
           -degreeId: Degree {#2103 ▶}
           -yearFrom: DateTime {#1411 ▶} 
    }
    1 => Education {#2100 ▼
         -id: 12
       -title: "bbbbbbbbbbbb"
          -degreeId: Degree {#2099 ▶}
      -yearFrom: DateTime {#2102 ▶}
      -yearTo: DateTime {#2101 ▶} 
  }
 ]

1 个答案:

答案 0 :(得分:0)

如果您需要访问所有

 MobileAds.initialize(getApplicationContext(), "ca-app-pub-9815982880222619/9339487889");

    mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);

否则,如果您需要特定元素

foreach ($yourArrayCollectionName as $element) {
  // here you have your elements
}