更新 symfony 5 后无法自动装配
Cannot autowite after update sumfony 5
我将 symfony 从 4.4 更新到 5.0 并得到这样的错误
Cannot autowire argument $category of "App\Controller\CategoryController::category()": it references class "App\Entity\Category" but no such service exists.
下面是我的控制器代码。
/**
* 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
]);
此代码适用于 symfony 4.4。
我该如何解决?
因为roukmoute/hashids-bundle。删除这个包后一切正常。
我将 symfony 从 4.4 更新到 5.0 并得到这样的错误
Cannot autowire argument $category of "App\Controller\CategoryController::category()": it references class "App\Entity\Category" but no such service exists.
下面是我的控制器代码。
/**
* 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
]);
此代码适用于 symfony 4.4。 我该如何解决?
因为roukmoute/hashids-bundle。删除这个包后一切正常。