1
閱讀symfony的文檔,http://symfony.com/doc/current/cookbook/doctrine/file_uploads.htmlSymfony 2文件上傳。如何在移動拋出異常()
// you must throw an exception here if the file cannot be moved
// so that the entity is not persisted to the database
// which the UploadedFile move() method does automatically
$this->file->move($this->getUploadRootDir(), $this->path);
但是,如果我做了
if ($this->file->move(...))
我
Catchable Fatal Error: Object of class Symfony\Component\HttpFoundation\File\File could not be converted to boolean in .../xxx.php line 96
感謝,Symfony的應儘快更新的文檔,以避免混淆... –
是的,你可以自己做;)https://github.com/symfony/symfony-docs – julesbou
文檔更新 - HTTPS: //github.com/symfony/symfony-docs/issues/908 該系統的工作原理! – weaverryan