Skip to content

Commit a139b2a

Browse files
author
Joseph Deray
committed
fixed issue with clone now the children of the original form are preserved and the clone form is given new children
1 parent fb8c69a commit a139b2a

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

Form.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ public function __construct(FormConfigInterface $config)
170170

171171
public function __clone()
172172
{
173+
$this->children = clone $this->children;
174+
173175
foreach ($this->children as $key => $child) {
174176
$this->children[$key] = clone $child;
175177
}

Tests/CompoundFormTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public function testCloneChildren()
141141

142142
$this->assertNotSame($this->form, $clone);
143143
$this->assertNotSame($child, $clone['child']);
144+
$this->assertNotSame($this->form['child'], $clone['child']);
144145
}
145146

146147
public function testNotEmptyIfChildNotEmpty()

0 commit comments

Comments
 (0)