2013-10-06 4 views
0

모든 자료의 ID를 얻는 방법?

public function indexAction() 
{ 


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

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

echo $midcount; 

방법 당신은 도움이?

공지 사항 : 정의되지 않은 인덱스 : ID

답변

1
$materials = $this->getDoctrine()->getRepository('TestBundle:Materials')->findAll(); 
$materialIds = array(); 
foreach ($materials as $material) { 
    $materialIds[] = $material->getId(); 
} 
+0

이 무엇을 원하세요? – zapcost