Skip to content

Commit 9f76823

Browse files
committed
Fix cloning ActionGroupDto
1 parent aa8b710 commit 9f76823

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)