0
나는이 간단한에 의해 출력 됨(다중) 내 양식에
<select multiple="multiple" name="action[files][]" id="action_files"></select>
:
$builder->add('files', 'choice', array('multiple' => true, 'required' => false));
setFiles()
기설 기록을 표시 할 때 작동되지만, getFiles()
이 작동하지 않습니다.
public function getFiles()
{
$array = array();
$documents = $this->getDocuments();
foreach ($documents as $document) {
$array[$document->getFilename()] = $document->getFilename();
}
return $array;
}
그것은거야 출력 :
다음은 게터의
array(1) { ["slide1.jpg"]=> string(10) "slide1.jpg" }
그러나 선택이 비어 있습니다.
어떻게하면 좋을까요?
$ douments가 실제로 비어 있지 않습니까? –
@MassimilianoArione 나는 getDocuments가 업로드 된 문서를 반환한다는 것을 120 % 확신합니다. 그래서 비어 있지 않다. –
확실하다. return하기 전에 getFiles()에서 var_dump ($ array)를 시도 했는가? –