Search code examples
phpsymfonysymfony5

Cannot autowite after update sumfony 5


I updated symfony from 4.4 to 5.0 and get errors like this

Cannot autowire argument $category of "App\Controller\CategoryController::category()": it references class "App\Entity\Category" but no such service exists.

My Controller code below.

/**
     * Renders category page with subcategories
     * @param Category $category
     * @return mixed
     */   
use App\Entity\Category;

public function category(Category $category) {
return $this->render('category/index.html.twig', [
    'category' => $category
]);

This code works on symfony 4.4. How can i fix it?


Solution

  • It was because roukmoute/hashids-bundle. After deleting this bundle all works fine.