当我在使用控制器时,我的计算机崩溃了,我需要重新启动它。然后,我决定使用php bin/console server:run
命令开始我的项目,但是出现以下错误:
我不认为这来自我的项目。我第一次看到这样的错误。它没有说它在哪里。到我的计算机关闭时,我正在使用管理控制器,但我认为这不是问题。但是这是代码:
<?php
namespace App\Controller;
use App\Entity\TradeOffer;
use App\Entity\User;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Session\Session;
class AdminController extends AbstractController
{
/**
* @Route("/BoardFind/Admin", name="AdminPanel")
*/
public function adminPanel()
{
return $this->render('Home/Admin.html.twig');
}
/**
* @Route("/BoardFind/Admin/AllUsers", name="AllUsers")
*/
public function adminPanelUsers()
{
$Users = $this->getDoctrine()
->getRepository(User::class)->findAll();
return $this->render('Home/ListUsers.html.twig', array(
"arrayOfUsers" => $Users,
));
}
/**
* @Route("/BoardFind/Admin/AllOffers", name="AllOffers")
*/
public function tadminPanelOffers()
{
$Offers = $this->getDoctrine()
->getRepository(TradeOffer::class)->findAll();
return $this->render('Home/ListUsers.html.twig', array(
"arrayOfOffers" => $Offers,
));
}
/**
* @Route("/BoardFind/Admin/DeleteUser/{id}", name="DeleteUser")
*/
public function adminPanelUserDelete($id)
{
$entityManager = $this->getDoctrine()->getManager();
$user = $entityManager->getRepository("App:User")
->find($id);
$user->setIsDeleted(true);
$entityManager->flush();
return $this->redirectToRoute('AllUsers');
}
/**
* @Route("/BoardFind/Admin/DeleteOffer/{id}", name="AllOffers")
*/
public function adminPanelOfferDelete($id)
{
return $this->render('Home/Admin.html.twig');
}
}
最后,我会说我真的不知道发生了什么,当我尝试重新配置服务器时,它会弹出以下错误:
答案 0 :(得分:-2)
尝试清除缓存,如果该缓存不起作用,则有时删除该文件夹,该命令无效