Skip to content

Commit

Permalink
bug #5635 Fix panels, rows and tabs when working with lazy ghost prox…
Browse files Browse the repository at this point in the history
…ies (Lustmored)

This PR was merged into the 4.x branch.

Discussion
----------

Fix panels, rows and tabs when working with lazy ghost proxies

This fixes #5624

The problem occurs when `PropertyAccessor` is trying to access a non-existent property of a lazy ghost object. They emit user notice right now, while EasyAdmin expects an exception to be thrown.

But in fact the value of tabs, panels and rows are never used and have no meaning. Their keys are randomly generated, so they never exist on entities and call to property accessor is pointless. Setting the value to `true` by default makes them mitigate property accessor at all and the problem outlined in the linked issue.

Commits
-------

44be4f9 Set tabs, rows and panel values to `true` by default.
  • Loading branch information
javiereguiluz committed Feb 16, 2023
2 parents 32209a4 + 44be4f9 commit 26142a0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Field/FormField.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public static function addPanel($label = false, ?string $icon = null): self
->setFormTypeOptions(['mapped' => false, 'required' => false])
->setCustomOption(self::OPTION_ICON, $icon)
->setCustomOption(self::OPTION_COLLAPSIBLE, false)
->setCustomOption(self::OPTION_COLLAPSED, false);
->setCustomOption(self::OPTION_COLLAPSED, false)
->setValue(true);
}

/**
Expand All @@ -73,7 +74,8 @@ public static function addRow(string $breakpointName = ''): self
->setFormType(EaFormRowType::class)
->addCssClass('field-form_row')
->setFormTypeOptions(['mapped' => false, 'required' => false])
->setCustomOption(self::OPTION_ROW_BREAKPOINT, $breakpointName);
->setCustomOption(self::OPTION_ROW_BREAKPOINT, $breakpointName)
->setValue(true);
}

/**
Expand All @@ -92,7 +94,8 @@ public static function addTab(TranslatableInterface|string $label, ?string $icon
->setFormType(EasyAdminTabType::class)
->addCssClass('field-form_tab')
->setFormTypeOptions(['mapped' => false, 'required' => false])
->setCustomOption(self::OPTION_ICON, $icon);
->setCustomOption(self::OPTION_ICON, $icon)
->setValue(true);
}

public function setIcon(string $iconCssClass): self
Expand Down

1 comment on commit 26142a0

@pfpro
Copy link
Contributor

@pfpro pfpro commented on 26142a0 Feb 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

Please sign in to comment.