2016-10-24 19 views
0

在本地主机万事都很好,但我已经部署了个项目后,我得到这个错误注释“@Gedmo弹头不存在,或无法被自动装载

[Semantical Error] The annotation "@Gedmo\Mapping\Annotation\slug" in property 
AppBundle\Entity\Product::$slug does not exist, or could not be auto-loaded. 

这是类产品

use Gedmo\Mapping\Annotation as Gedmo; 
abstract class Prodcut 
{ 
/** 
* @var int 
* 
* @ORM\Column(name="id", type="integer") 
* @ORM\Id 
* @ORM\GeneratedValue(strategy="AUTO") 
*/ 
protected $id; 

/** 
* @var string 
* 
* @ORM\Column(name="name", type="string", length=255) 
*/ 
private $name; 

/** 
* @var string 
* @Gedmo\slug(fields={"name"}) 
* @ORM\Column(name="slug", type="string", length=255, unique=true) 
*/ 
private $slug; 

回答

4

那是因为你的注释中定义别名:

use Gedmo\Mapping\Annotation as Gedmo; 

,然后用它作为@Gedmo\slug(fields={"name"})其插值到:

@Gedmo\Mapping\Annotation\slug(fields={"name"}) 

正确名称是资本S

@Gedmo\Slug(fields={"name"}) 
相关问题