doctrine 2のプロキシクラスプロパティにアクセスする際に、EntityNotFoundExceptionの考えられる原因は何ですか?とにかく、次は私のエンティティの構造であり、次のようにdoctrine 2プロキシクラスのEntityNotFoundException
/**
* @ORM\Table(name="comments")
*
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="comment_type", type="smallint")
* @ORM\DiscriminatorMap({
* 1 = "VisitorComment",
* 2 = "MemberComment"
* })
*/
class Comment
{
//with common properties of its subclasses
}
サブクラスは以下のとおりです。
/**
* @ORM\Table(name="member_comments")
*/
class MemberComment extends Comment
{
/**
* owning side
*
* @var Member $author
*
* @ORM\ManyToOne(targetEntity="Member")
* @ORM\JoinColumn(name="author_id", referencedColumnName="id", nullable=false)
*/
private $author;
/**
* Set author
*
* @param Member $author
*/
public function setAuthor($author)
{
$this->author = $author;
}
/**
* Get author
*
* @return Member
*/
public function getAuthor()
{
return $this->author;
}
}
/**
* @ORM\Table(name="visitor_comments")
*/
class VisitorComment extends Comment
{
/**
* owning side
*
* @var Visitor $author
*
* @ORM\ManyToOne(targetEntity="Visitor")
* @ORM\JoinColumn(name="author_id", referencedColumnName="id", nullable=false)
*/
private $author;
/**
* Set author
*
* @param string $author
*/
public function setAuthor($author)
{
$this->author = $author;
}
/**
* Get author
*
* @return Visitor
*/
public function getAuthor()
{
return $this->author;
}
}
私は> GETAUTHOR()$ COMMENT-を呼び出すときに例外が発生した - と仮定し< > getFirstName() MemberまたはVisitorエンティティの著者にはfirstNameプロパティ>があります。この場合のgetAuthor()は、VisitorProxyまたはMemberProxyのプロキシクラスを返します。
親切に私を助けてください。私はまだ教義を初めて学んでいます。
私のせいでした。私はまだ手動でデータベースに自分のデータを追加するので、私は間違いなく、訪問者をメンバーコメントに、メンバーを訪問者コメントに著者と交換しました。 – Floricel