symfony2中出现自动加载器错误的原因

时间:2013-02-23 11:19:34

标签: symfony symfony-2.1 symfony-2.2

任何人都可以告诉我为什么autmader错误出现在symfony2中。 什么是parmenanat解决方案。我已经下载了与供应商的symfony2版本,所有的东西都正常工作接受当我插入自定义类并尝试使用它总是引发自动加载错误请给我它的解决方案。错误消息如下所示。

The autoloader expected class "Blogger\BlogBundle\Entity\Enquiry" 
to be defined in file
"D:\wamp\www\Symfony/src/\Blogger\BlogBundle\Entity\Enquiry.php". 
The file was found but the class was not in it, 
the class name or namespace probably has a typo. 

这是询问课。

<?php

namespace Blogger\BlogBungle\Entity;

class Enquiry
{

protected $name;
protected $email;
protected $subject;
protected $body;

public function getName()
{
    return $this->name;

}
public function setName($name)
{
    $this->name = $name;
}
public function getEmail()
{
    return $this->email;
}
public function setEmail($email)
{
    $this->email = $email;
}
public function getSubject()
{
    return $this->subject;
}
public function setSubject($subject)
{
    $this->subject = $subject;
}
public function getBody()
{
    return $this->body;
}
public function setBody($body)
{
    $this->body = $body;
}


}


?>

1 个答案:

答案 0 :(得分:3)

查看

之间的区别
namespace Blogger\BlogBungle\Entity;

 Blogger\BlogBundle\Entity\Enquiry

错误消息? BlogBu​​ngle应该是BlogBu​​ndle ,当您定义命名空间时。