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

时间:2016-10-24 14:27:33

标签: symfony slug doctrine-extensions

在localhost中,一切正常,但在我部署项目后,我收到此错误

[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;

1 个答案:

答案 0 :(得分:4)

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

            if(Schema.SobjectType.Tracking_path__c.isdeletable())
            {
                Delete tpList;
            }    
            else
            {
                ApexPages.addMessage(new  ApexPages.message(ApexPages.severity.FATAL, system.label.delete_access)); 
                return null; 
            } 

然后将其用作use Gedmo\Mapping\Annotation as Gedmo; 插入到:

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

正确的名称是大写@Gedmo\Mapping\Annotation\slug(fields={"name"})

S