You must first create a valid object from your default file.
To do this, use Symfony \ Component \ HttpFoundation \ File .
Using: $file = new File('path/of/your/default/file');
, .
:
1- FormEvent
, , null. (, PRE_SUBMIT
POST_SUBMIT
)
2- prePersist/preUpdate. ( , "" )
1 . " " ( โโ ).
2, . Events Doctrine.
- :
class YourEntity {
public function manageFile()
{
if ($this->attachment === null) {
$file = new File('path/of/your/default/file');
$this->setAttachment($file);
}
}
}
, .