注释“@Gedmo Slug 不存在,或无法自动加载

The annotation "@Gedmo Slug does not exist, or could not be auto-loaded

在本地主机上一切正常,但在我部署项目后出现此错误

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

这是class产品

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;

那是因为您为注解定义了别名:

use Gedmo\Mapping\Annotation as Gedmo;

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

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

正确的名字是大写 S:

@Gedmo\Slug(fields={"name"})