Skip to content

Commit

Permalink
add deprecation notice not setting the "admin_code"
Browse files Browse the repository at this point in the history
  • Loading branch information
piddubnij committed Jan 3, 2023
1 parent a49bba1 commit fd95b18
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Twig/RolesMatrixExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,19 @@ public function renderMatrix(Environment $environment, FormView $form): string
$groupedRoles = [];
foreach ($this->rolesBuilder->getRoles() as $role => $attributes) {
if (!isset($attributes['admin_code'])) {
continue;
// NEXT_MAJOR: Remove those lines and uncomment the last one.
@trigger_error(
'Not setting the "admin_code" attribute to admin role is deprecated since sonata-project/user-bundle 5.5'
.' and without it admin role will be skipped in version 6.0.',
\E_USER_DEPRECATED
);

if (!isset($attributes['admin_label'])) {
continue;
}

$attributes['admin_code'] = $attributes['admin_label'];
// continue;
}

$groupCode = $attributes['group_code'] ?? '';
Expand Down

0 comments on commit fd95b18

Please sign in to comment.