0

助けて

public function indexAction() 
{


$tpos = $this->getDoctrine()->getRepository('TestBundle:Materials')->findAll();

foreach($tposs as $tpos) {
     $posts['id'];
} 

echo $midcount;

どうしますか?

注意: 未定義のインデックス: id

4

1 に答える 1

1
$materials = $this->getDoctrine()->getRepository('TestBundle:Materials')->findAll();
$materialIds = array();
foreach ($materials as $material) {
    $materialIds[] = $material->getId();
}
于 2013-10-06T18:21:40.130 に答える