Skip to content

Commit

Permalink
Process NEXT_MAJOR hints for "Add pre batch action event"
Browse files Browse the repository at this point in the history
A pre batch action event was added to 4.x through sonata-project#7579. This
processes all the NEXT_MAJOR comments for 5.x for this specific
feature
  • Loading branch information
7ochem committed Nov 25, 2021
1 parent 065227c commit 62abb28
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
5 changes: 0 additions & 5 deletions src/Admin/AbstractAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ public function configureBatchActions(AdminInterface $admin, array $actions): ar
return $actions;
}

// NEXT_MAJOR: Remove the PHPDoc block as the interface will then specify the types
/**
* @param mixed[] $idx
* @phpstan-param AdminInterface<T> $admin
*/
public function preBatchAction(AdminInterface $admin, string $actionName, ProxyQueryInterface $query, array &$idx, bool $allElements): void
{
}
Expand Down
15 changes: 5 additions & 10 deletions src/Admin/AdminExtensionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
/**
* @author Thomas Rabaix <[email protected]>
*
* NEXT_MAJOR: Uncomment the actual definition of below methods inside the interface and remove these annotations.
*
* @method void preBatchAction(AdminInterface $admin, string $actionName, ProxyQueryInterface $query, array &$idx, bool $allElements)
*
* @phpstan-template T of object
*/
interface AdminExtensionInterface
Expand Down Expand Up @@ -131,12 +127,11 @@ public function getAccessMapping(AdminInterface $admin): array;
*/
public function configureBatchActions(AdminInterface $admin, array $actions): array;

// NEXT_MAJOR: Uncomment the method definition
///**
// * @param mixed[] $idx
// * @phpstan-param AdminInterface<T> $admin
// */
//public function preBatchAction(AdminInterface $admin, string $actionName, ProxyQueryInterface $query, array &$idx, bool $allElements): void;
/**
* @param mixed[] $idx
* @phpstan-param AdminInterface<T> $admin
*/
public function preBatchAction(AdminInterface $admin, string $actionName, ProxyQueryInterface $query, array &$idx, bool $allElements): void;

/**
* Get a chance to modify export fields.
Expand Down
6 changes: 1 addition & 5 deletions src/Controller/CRUDController.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,11 +501,7 @@ public function batchAction(Request $request): Response

$this->admin->preBatchAction($action, $query, $idx, $allElements);
foreach ($this->admin->getExtensions() as $extension) {
// NEXT_MAJOR: Remove the if-statement around the call to `$extension->preBatchAction()`
// @phpstan-ignore-next-line
if (method_exists($extension, 'preBatchAction')) {
$extension->preBatchAction($this->admin, $action, $query, $idx, $allElements);
}
$extension->preBatchAction($this->admin, $action, $query, $idx, $allElements);
}

if (\count($idx) > 0) {
Expand Down

0 comments on commit 62abb28

Please sign in to comment.