Note that there are some explanatory texts on larger screens.

plurals
  1. POEntityNotFoundException in doctrine 2 proxy class
    primarykey
    data
    text
    <p>What are the possible causes of EntityNotFoundException while accessing the proxy class properties in doctrine 2? Anyway, the following is my entities' structure:</p> <pre><code>/** * @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 } </code></pre> <p>subclasses are as follows:</p> <pre><code>/** * @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-&gt;author = $author; } /** * Get author * * @return Member */ public function getAuthor() { return $this-&gt;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-&gt;author = $author; } /** * Get author * * @return Visitor */ public function getAuthor() { return $this-&gt;author; } } </code></pre> <p>The exception occurs when I call $comment->getAuthor()->getFirstName() &lt;<em>assuming that author which is either a Member or Visitor entity has firstName property</em>>. The getAuthor() in this case returns a proxy class of either VisitorProxy or MemberProxy. </p> <p>Kindly help me. I'm still new to doctrine.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload