Browse files

set the default data class automatically

  • Loading branch information...
1 parent 685e696 commit c84f1fe94ce44dcd389b6862f72a6622e5bd03fa @dbu dbu committed Mar 12, 2013
Showing with 6 additions and 0 deletions.
  1. +6 −0 Form/Type/ImageType.php
View
6 Form/Type/ImageType.php
@@ -3,6 +3,7 @@
namespace Doctrine\Bundle\PHPCRBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
+use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\Bundle\PHPCRBundle\Form\DataTransformer\ModelToFileTransformer;
@@ -23,4 +24,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$transformer = new ModelToFileTransformer();
$builder->addModelTransformer($transformer);
}
+
+ public function setDefaultOptions(OptionsResolverInterface $options)
+ {
+ $options->setDefaults(array('data_class' => 'Doctrine\ODM\PHPCR\Document\Image'));
+ }
}

0 comments on commit c84f1fe

Please sign in to comment.