2014-07-24 4 views
2

내가 범주와 하위 범주 구조 엔티티를 구현하기 위해 노력하고 있지만, 명령 php app/console generate:doctrine:entities RFQIronilBundle로 엔티티를 생성 할 때이 오류와 끝까지 찾을 수 없습니다 :의미 론적 오류 - 상수 X, 클래스 ... 오류

[Doctrine\Common\Annotations\AnnotationException]        
    [Semantical Error] Couldn't find constant production, class RFQ\IronilBundl 
    e\Entity\ProductionType. 

을 내가 만든 ProductionType 엔터티 :

<?php 

namespace RFQ\IronilBundle\Entity; 

use Doctrine\ORM\Mapping as ORM; 

/** 
* ProductionType 
* 
* @ORM\Table(production-type) 
* @ORM\Entity 
*/ 
class ProductionType 
{ 
    /** 
    * @var integer 
    * 
    * @ORM\Column(name="id", type="integer") 
    * @ORM\Id 
    * @ORM\GeneratedValue(strategy="AUTO") 
    */ 
    private $id; 

    /** 
    * @ORM\Column(type="string", length=100) 
    */ 
    protected $name; 

    /** 
    * @ORM\OneToMany(targetEntity="ProductionType", mappedBy="parent") 
    **/ 
    protected $children; 

    /** 
    * @ORM\ManyToOne(targetEntity="ProductionType", inversedBy="children") 
    * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") 
    **/ 
    protected $parent; 

    /** 
    * Get id 
    * 
    * @return integer 
    */ 
    public function getId() 
    { 
     return $this->id; 
    } 
} 

내 엔터티를 생성하는 방법과이 오류의 원인은 무엇입니까? 감사합니다.

답변

3

테이블 이름 주위에 음성 마크를 사용하지 않았기 때문에 생각합니다.

@ORM\Table(production-type) // meant (constant) production minus (constant) type 

위치를

@ORM\Table("production-type") 

를 사용해야합니다 그리고 그것은 더 의미가 MySQL의 문에서 테이블 이름 주위의 인용 부호의 필요성을 중지 production_type를 사용할 수 있도록 할 수있다.

+0

예, 그건 내 어리석은 실수였습니다! 때때로 구문 오류를 볼 수는 없지만 도움이 될 수있는 프로그래머가있어서 기쁩니다. 고맙습니다! – RydelHouse

+0

신선한 눈, 그것이 전부입니다. – qooplmao