Skip to content

Instantly share code, notes, and snippets.

@rande
Created June 17, 2011 14:39
Show Gist options
  • Save rande/1031544 to your computer and use it in GitHub Desktop.
Save rande/1031544 to your computer and use it in GitHub Desktop.
diff --git a/Form/ChoiceList/ModelChoiceList.php b/Form/ChoiceList/ModelChoiceList.php
index e67befd..f95ca6d 100644
--- a/Form/ChoiceList/ModelChoiceList.php
+++ b/Form/ChoiceList/ModelChoiceList.php
@@ -111,7 +111,7 @@ class ModelChoiceList extends ArrayChoiceList
{
parent::load();
- if ($this->choices) {
+ if (is_array($this->choices)) {
$entities = $this->choices;
} else if ($this->query) {
$entities = $this->modelManager->executeQuery($this->query);
diff --git a/Form/FormMapper.php b/Form/FormMapper.php
index 8a586ce..176a971 100644
--- a/Form/FormMapper.php
+++ b/Form/FormMapper.php
@@ -50,7 +50,7 @@ class FormMapper
* @param string $name
* @param array $fieldOptions
* @param array $fieldDescriptionOptions
- * @return \Symfony\Component\Form\FieldInterface|void
+ * @return \Sonata\AdminBundle\Form\FormMapper
*/
public function add($name, array $fieldOptions = array(), array $fieldDescriptionOptions = array())
{
diff --git a/Form/Type/ImmutableArrayType.php b/Form/Type/ImmutableArrayType.php
index b4113d7..78dfb04 100644
--- a/Form/Type/ImmutableArrayType.php
+++ b/Form/Type/ImmutableArrayType.php
@@ -13,6 +13,8 @@ namespace Sonata\AdminBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
+use Symfony\Component\Form\FormView;
+use Symfony\Component\Form\FormInterface;
use Sonata\AdminBundle\Form\EventListener\ResizeFormListener;
diff --git a/Form/Type/ModelType.php b/Form/Type/ModelType.php
index 7dc4fbc..9193a39 100644
--- a/Form/Type/ModelType.php
+++ b/Form/Type/ModelType.php
@@ -45,7 +45,7 @@ class ModelType extends AbstractType
'class' => null,
'property' => null,
'query' => null,
- 'choices' => array(),
+ 'choices' => null,
'parent' => 'choice',
'preferred_choices' => array(),
'field_description' => false,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment