diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Form/BaseField.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Form/BaseField.php index 076ea555c678..f7863d273bc4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Form/BaseField.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Form/BaseField.php @@ -123,7 +123,7 @@ protected function wrapFields($fields) protected function createField(FormFieldInterface $field) { - if ($field instanceof Form || get_class($field) === 'Symfony\Component\Form\FieldGroup') { + if ($field instanceof FieldGroupInterface && !$field instanceof HybridField) { return new FieldGroup($field, $this->engine, $this->generator, $this->theme, $this->doctype); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Form/Field.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Form/Field.php index 3f8809955235..8f01c47fc17c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Form/Field.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Form/Field.php @@ -2,6 +2,9 @@ namespace Symfony\Bundle\FrameworkBundle\Templating\Form; +use Symfony\Component\Form\FieldGroupInterface; +use Symfony\Component\Form\HybridField; + /* * This file is part of the Symfony framework. * @@ -22,7 +25,7 @@ class Field extends BaseField public function render($template = null) { - if ($this->field instanceof Form || get_class($this->field) === 'Symfony\Component\Form\FieldGroup') { + if ($this->field instanceof FieldGroupInterface && !$this->field instanceof HybridField) { throw new \LogicException(sprintf('Cannot render a group field as a row (%s)', $this->field->getKey())); } @@ -40,7 +43,7 @@ public function data() public function widget(array $attributes = array(), $template = null) { - if ($this->field instanceof Form || get_class($this->field) === 'Symfony\Component\Form\FieldGroup') { + if ($this->field instanceof FieldGroupInterface && !$this->field instanceof HybridField) { throw new \LogicException(sprintf('Cannot render a group field (%s)', $this->field->getKey())); }