diff --git a/Form/Type/FileTypeBindSubscriber.php b/Form/Type/FileTypeBindSubscriber.php index 5d7b9bb..477d239 100644 --- a/Form/Type/FileTypeBindSubscriber.php +++ b/Form/Type/FileTypeBindSubscriber.php @@ -55,7 +55,14 @@ public function preSet(FormEvent $event) $obj = $form->getParent()->getData(); - if (!$obj) return; + if (!$obj) { + if ($data_class = $form->getParent()->getConfig()->getOption('data_class')) { + $obj = new $data_class(); + } + else { + return; + } + } $mapping = $this->mappingFactory->getMappingFromField($obj, $this->dataStorage->getReflectionClass($obj), diff --git a/README.md b/README.md index e4f9a48..d3473c9 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,17 @@ For Russian documentation see http://symfonydev.ru/iphpfilestorebundle/ Add the following lines in your composer.json: ``` -{ "require": { - "iphp/filestore-bundle" : "@stable" - } -} + ... + "iphp/filestore-bundle" : "dev-fix_embedded", + ... + }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/sneakyvv/IphpFileStoreBundle.git" + } + ], ``` ### Initialize the bundle