diff --git a/packages/sonata-extra-bundle/Extension/AutoActionExtension.php b/packages/sonata-extra-bundle/Extension/AutoActionExtension.php index 9f90da6b..84001efa 100644 --- a/packages/sonata-extra-bundle/Extension/AutoActionExtension.php +++ b/packages/sonata-extra-bundle/Extension/AutoActionExtension.php @@ -38,21 +38,22 @@ public function configureListFields(ListMapper $list): void } } + $actions = []; $routes = $admin->getRoutes(); foreach ($this->actions as $action => $options) { - if (!$routes->has($routes->getCode($action))) { - unset($this->actions[$action]); + if ($routes->has($routes->getCode($action))) { + $actions[$action] = $options; } } - if (!empty($this->actions)) { + if (!empty($actions)) { $list->add( ListMapper::NAME_ACTIONS, ListMapper::TYPE_ACTIONS, [ 'label' => 'Action', - 'actions' => $this->actions, + 'actions' => $actions, ] ); }