8000 Revert "bug #20080 [Form] compound forms without children should be c… · symfony/symfony@35091b1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 35091b1

Browse files
committed
Revert "bug #20080 [Form] compound forms without children should be considered rendered implicitly (backbone87)"
This reverts commit eae5a9b, reversing changes made to fd763ad.
1 parent eae5a9b commit 35091b1

File tree

2 files changed

+6
-61
lines changed

2 files changed

+6
-61
lines changed

src/Symfony/Component/Form/FormView.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,8 @@ public function __construct(FormView $parent = null)
6565
*/
6666
public function isRendered()
6767
{
68-
if ($this->rendered) {
69-
return true;
70-
}
71-
72-
if (isset($this->vars['compound']) ? !$this->vars['compound'] : 0 === count($this->children)) {
73-
return false;
68+
if (true === $this->rendered || 0 === count($this->children)) {
69+
return $this->rendered;
7470
}
7571

7672
foreach ($this->children as $child) {

src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php

Lines changed: 4 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -488,67 +488,16 @@ public function testPassMultipartTrueIfAnyChildIsMultipartToView()
488488
$this->assertTrue($view->vars['multipart']);
489489
}
490490

491-
public function testViewIsConsideredRenderedForRenderedNonCompoundForms()
492-
{
493-
$view = $this->factory->createBuilder('form', null, array(
494-
'compound' => false,
495-
))
496-
->getForm()
497-
->createView();
498-
499-
$view->setRendered();
500-
501-
$this->assertTrue($view->isRendered());
502-
}
503-
504-
public function testViewIsNotConsideredRenderedImplicitlyForNonCompoundForms()
505-
{
506-
$view = $this->factory->createBuilder('form', null, array(
507-
'compound' => false,
508-
))
509-
->getForm()
510-
->createView();
511-
512-
$this->assertFalse($view->isRendered());
513-
}
514-
515-
public function testViewIsNotConsideredRenderedImplicitlyForCompoundFormsWithNonCompoundChildren()
491+
public function testViewIsNotRenderedByDefault()
516492
{
517493
$view = $this->factory->createBuilder('form')
518-
->add('foo', 'form', array(
519-
'compound' => false,
520-
))
521-
->getForm()
522-
->createView();
494+
->add('foo', 'form')
495+
->getForm()
496+
->createView();
523497

524498
$this->assertFalse($view->isRendered());
525499
}
526500

527-
public function testViewIsConsideredRenderedImplicitlyForCompoundFormsWithRenderedNonCompoundChildren()
528-
{
529-
$view = $this->factory->createBuilder('form')
530-
->add('foo', 'form', array(
531-
'compound' => false,
532-
))
533-
->getForm()
534-
->createView();
535-
536-
foreach ($view as $child) {
537-
$child->setRendered();
538-
}
539-
540-
$this->assertTrue($view->isRendered());
541-
}
542-
543-
public function testViewIsConsideredRenderedImplicitlyForCompoundFormsWithoutChildren()
544-
{
545-
$view = $this->factory->createBuilder('form')
546-
->getForm()
547-
->createView();
548-
549-
$this->assertTrue($view->isRendered());
550-
}
551-
552501
public function testErrorBubblingIfCompound()
553502
{
554503
$form = $this->factory->create('form', null, array(

0 commit comments

Comments
 (0)
0