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 回答