簡體   English   中英

找不到FatalErrorException類

[英]FatalErrorException Class not found

您好,我不知道如何解決該錯誤,我在Google中進行了搜索,但沒有針對該錯誤的解決方案

FatalErrorException:錯誤:在/home/ahmed/www/Symfony/src/Blogger/BlogBu​​ndle/Controller/PageController.php第20行中找不到類'Blogger \\ BlogBu​​ndle \\ Controller \\ Entity \\ Enquiry'

in /home/ahmed/www/Symfony/src/Blogger/BlogBundle/Controller/PageController.php line 20

namespace Blogger\BlogBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Blogger\BlogBundle\Controller\Entity\Enquiry ;
use Blogger\BlogBundle\Controller\Form\EnquiryType;

class PageController extends Controller {

    public function indexAction() {
        return $this->render('BloggerBlogBundle:Page:index.html.twig');
    }

    public function aboutAction() {
        return $this->render('BloggerBlogBundle:Page:about.html.twig');
    }
     public function contactAction() {
        $enquiry = new Enquiry();
        $form = $this->createForm(new EnquiryType(), $enquiry);
        $request = $this->getRequest();
        if ($request->getMethod() == 'POST') {
            $form->bind($request);
            if ($form->isValid()) {
                return $this->redirect($this->generateUrl('BloggerBlogBundle_contact'));
            }
        }
        return $this->render('BloggerBlogBundle:contact.html.twig', array('form' => $form->createView()));
    }

}

錯字

在行尾看到分號之間的空白

使用Blogger \\ BlogBu​​ndle \\ Controller \\ Entity \\ Enquiry;

默認情況下,Symfony不對實體類使用控制器名稱空間。

只需嘗試use Blogger\\BlogBundle\\Entity\\Enquiry;

信息不多,所以我嘗試提示

您確定您的實體文件夾(及其名稱空間)在Controller Folder / Namespace內嗎?

通常,實體名稱空間是Project \\ Bundle \\ Entity \\ MyEntity(與表單和類型相同)

提前...在重定向之前,您需要在重定向之前調用 實體管理器flush()方法 (如果是新對象,則保持該方法),否則將不保存對查詢的更改。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM