Skip to content

Commit 2fdfb24

Browse files
committed
bug #7115 Fix cloning ActionGroupDto (fracsi)
This PR was merged into the 4.x branch. Discussion ---------- Fix cloning ActionGroupDto Fixes: #7114 Commits ------- 9f76823 Fix cloning ActionGroupDto
2 parents aa8b710 + 9f76823 commit 2fdfb24

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Dto/ActionGroupDto.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ final class ActionGroupDto
3030
private ButtonStyle $style = ButtonStyle::Solid;
3131
private bool $hasAnyActionWithIcon = false;
3232

33+
public function __clone(): void
34+
{
35+
if (null !== $this->mainAction) {
36+
$this->mainAction = clone $this->mainAction;
37+
}
38+
39+
foreach ($this->items as $index => $item) {
40+
if ($item instanceof ActionDto) {
41+
$this->items[$index] = clone $item;
42+
}
43+
}
44+
}
45+
3346
// A utility method for Twig templates that deal with actions and action groups
3447
public function isActionGroup(): bool
3548
{

0 commit comments

Comments
 (0)