Reputation: 41
I am developing a symfony 5 web project and I have to make as an university project. I started from the admin part and I used the bundle easyadmin by easycorp. I made the crud first all good but then by advancing in the project I started receiving below error
EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator::setCrudId(): Argument #1 ($crudId) must be of type string, null given, called in /Applications/MAMP/htdocs/appmusic/vendor/twig/twig/src/Extension/CoreExtension.php on line 1541
and I have no clue from it is coming. Started another project and again same issue.
Please I need your help if you guys may come in handy. Thank you very much
Upvotes: 4
Views: 2855
Reputation: 61
Faced the same problem with FastTrack.
First I removed the admin
$ symfony composer remove 'admin'
After I installed the latest
$ symfony composer req 'admin'
Not sure it's needed.
Solved by following https://github.com/EasyCorp/EasyAdminBundle/blob/master/UPGRADE.md look for Generating links to EasyAdmin pages
So now I use AdminUrlGenerator instead of CrudUrlGenerator
Now my DashboardController is class DashboardController extends AbstractDashboardController { private $adminUrlGenerator;
public function __construct(AdminUrlGenerator $adminUrlGenerator)
{
$this->adminUrlGenerator = $adminUrlGenerator;
}
/**
* @Route("/admin", name="admin")
*/
public function index(): Response
{
$url = $this->adminUrlGenerator
->setController(ConferenceCrudController::class)
//->setAction('edit')
//->setEntityId(1)
->generateUrl();
//$routeBuilder = $this->get(CrudUrlGenerator::class)->build();
//$url = $routeBuilder->setController(ConferenceCrudController::class)->generateUrl();
return $this->redirect($url);
//return parent::index();
}
...
Upvotes: 6