¿Cuáles son las posibles causas de EntityNotFoundException al acceder a las propiedades de la clase proxy en la doctrina 2? De todos modos, la siguiente es la estructura de mis entidades:EntityNotFoundException en la clase proxy proxy doctrina 2
/**
* @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
}
subclases son las siguientes:
/**
* @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;
}
}
La excepción se produce cuando llamo $ comentario-> getAutor() -> getFirstName() < asumiendo ese autor que es un miembro o una entidad visitante tiene la propiedad firstName>. El getAuthor() en este caso devuelve una clase proxy de VisitorProxy o MemberProxy.
Amablemente ayúdame. Todavía soy nuevo en la doctrina.
Fue mi culpa. Como todavía agrego manualmente mis datos en la base de datos, intercambié por error el visitante con el comentario del miembro y el miembro con el comentario del visitante como autor. – Floricel