global batch action giving crudControllerFqcn null error
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start with ArgumentResolver/BatchActionDtoResolver.php at line 65 and the AdminUrlGenerator::setController() call, then reproduce the global batch action using the ListingCrudController example. Trace why the batch action has no CRUD controller and add or update a regression test so the action completes without passing null.
Written by the indexing model from the issue text.
Description
Describe the bug
EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator::setController(): Argument #1 ($crudControllerFqcn) must be of type string, null given, called in /home/shivansh/Workspace/brokertruf/vendor/easycorp/easyadmin-bundle/src/ArgumentResolver/BatchActionDtoResolver.php on line 65
To Reproduce
try to create global batch action
<?php
namespace App\Controller\Admin;
use App\Entity\Listing;
use EasyCorp\Bundle\EasyAdminBundle\Attribute\AdminAction;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Dto\BatchActionDto;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\Response;
class ListingCrudController extends AbstractCrudController
{
public function __construct(
private EntityManagerInterface $entityManager
) {}
public static function getEntityFqcn(): string
{
return Listing::class;
}
public function configureActions(Actions $actions): Actions
{
$batchUpdate = Action::new('batchUpdate', 'Update Age')
->linkToCrudAction('batchUpdate')
->addCssClass('btn btn-primary')
->setIcon('fa fa-clock');
return $actions
->addBatchAction($batchUpdate);
}
public function batchUpdate(BatchActionDto $batchActionDto): Response
{
$entityIds = $batchActionDto->getEntityIds();
try {
$qb = $this->entityManager->createQueryBuilder();
$qb->update($batchActionDto->getEntityFqcn(), 'e')
->set('e.ageOfListing', ':now')
->where($qb->expr()->in('e.id', ':ids'))
->setParameter('now', new \DateTimeImmutable('now'))
->setParameter('ids', $entityIds)
->getQuery()
->execute();
$this->addFlash('success', sprintf('%d listing(s) updated.', count($entityIds)));
} catch (\Exception $e) {
$this->addFlash('error', 'Update failed.');
}
return $this->redirect($batchActionDto->getReferrerUrl());
}
}
- Dominant language
- PHP
- Stars
- 4.3k
- Forks
- 1.1k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 52
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from EasyCorp/EasyAdminBundle
-
bug design
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
EasyCorp/EasyAdminBundle#7958 ·
Maintainers usually reply within 2 days
-
design feature
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
EasyCorp/EasyAdminBundle#7930 ·
Maintainers usually reply within 2 days
-
design
Difficulty 2/5 Under an hour Newbie friendliness 88/100
EasyCorp/EasyAdminBundle#7879 ·
Maintainers usually reply within 2 days
-
design
Difficulty 1/5 Under an hour Newbie friendliness 90/100
EasyCorp/EasyAdminBundle#7875 ·
Maintainers usually reply within 2 days
-
#[AdminRoute]: the requirements of an action silently replace the ones of the classPossibly taken @anthonyhacart claimed this 1 day ago. Openfeature
Difficulty 3/5 Half a day Newbie friendliness 30/100
EasyCorp/EasyAdminBundle#7956 ·
Maintainers usually reply within 2 days
All issues in EasyCorp/EasyAdminBundle
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
taskforcesh/bullmq#5238 ·
Maintainers usually reply within 1 day
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects itPossibly taken @bfs2021 claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Automattic/jetpack#55517 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
area/import type/enhancement when/later
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day