0
편집에 정의 된 속성 : 내가 배운 내 서브 클래스 실종 annotiation가 있다고 (그린 리프로, THX '여기 그냥 ID입니다'). 내 실제 문제는 지금은 모르겠지만이 문제를 무시하는 방법입니다. 제대로 작동하지 않습니다.심포니/교리가 : annotiation를 추가하는 것은 'MappedSuperclass'
원본 :
난 그냥 단방향 일대-관계에 관한, 심포니 2.2 심포니 2.0 응용 프로그램을 마이그레이션하고 DEV-프로파일 러의 '잘못된 entities' 정보를 얻을 수 . 'ID가'슈퍼 클래스에 정의되어 있기 때문에이 잘못된 것으로,
* The association \Entity\Watched#reference refers to the inverse side field \Entity\Reference#id which is not defined as association.
* The association \Entity\Watched#reference refers to the inverse side field \Entity\Reference#id which does not exist.
내가 생각 :
php console doctrine:schema:validate
와 콘솔을 사용할 때 나는이 메시지가 나타납니다. 애플리케이션 스틸은 이전 DB (Symfony 2.0으로 생성)에서 정상적으로 실행됩니다. .... 모든
/**
* @ORM\MappedSuperclass
* @ORM\HasLifecycleCallbacks
*/
abstract class SuperclassAbstract {
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id = "";
// some fields more...
}
/**
* @ORM\Entity
* @ORM\Table(name="watched")
*/
class Watched extends SuperclassAbstract {
/**
* @ORM\ManyToOne(targetEntity="Reference", inversedBy="id")
* @ORM\JoinColumn(name="reference_id", referencedColumnName="id")
*/
protected $reference;
// some fields more...
}
/**
* @ORM\Entity
* @ORM\Table(name="reference")
*/
class Reference extends SuperclassAbstract {
// some fields more...
}
inversedBy에서 OneToMany로 정의 된 필드를 넣어야합니다. 여기에 ID가있는 것입니다. 그래서 그 것이 잘못되었습니다. – Pierrickouw