title: The target-entity "some entity" cannot be found
body: <p>i am using ZF2 with doctrine i am getting this error. </p>
  
  <blockquote>
    <p>The target-entity Entity\User cannot be found in 'Subject\Entity\Subject#user'.</p>
  </blockquote>
  
  <p>Here is the snippet to my code.</p>
  
  <pre><code>&lt;?php
  
  namespace Subject\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use Zend\InputFilter\InputFilter;
  use Zend\InputFilter\Factory as InputFactory;
  use Zend\InputFilter\InputFilterAwareInterface;
  use Zend\InputFilter\InputFilterInterface;
  /** 
  
  * @ORM\Entity
  
  * @ORM\Table(name="subject")
  
  * @property string $subjectname
  
  * @property int $user_id
  
  * @property int $id
  
  */
   class Subject implements InputFilterAwareInterface {
  
    protected $inputFilter;
   /**
  
   * @ORM\Id
  
   * @ORM\Column(type="integer");
  
   * @ORM\GeneratedValue(strategy="AUTO")
  
   */
  protected $id;
  /**
  
   * @ORM\Column(type="string")
  
   */
  protected $subjectname;
  
  /**
   * @ORM\ManyToOne(targetEntity="Entity\User", inversedBy="subjects")
   * @var User|null
   */
  private $user;
  
  /** @return User|null */
  public function getUser() {
      return $this-&gt;user;
  }
  
  /** @param User $user */
  public function setUser(User $user) {
      if($user === null || $user instanceof User) {
          $this-&gt;user = $user;
      } else {
          throw new InvalidArgumentException('$user must be instance of Entity\User or null!');
      }
  }}
  </code></pre>
  
  <p>and then my "User" entity</p>
  
  <p>
  
  <pre><code>namespace Subject\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use Zend\InputFilter\InputFilter;
  use Zend\InputFilter\Factory as InputFactory;
  use Zend\InputFilter\InputFilterAwareInterface;
  use Zend\InputFilter\InputFilterInterface;
  
  /*
  * @ORM\Entity
  
  * @ORM\Table(name="users")
  
  * @property string $username
  
  * @property string $password
  
  * @property int $id
  
  */
  class User implements InputFilterAwareInterface {
  
   protected $_username;
   protected $_password;
  
   /**
   * @ORM\OneToMany(targetEntity="Entity\Subject", mappedBy="user")
   * @var Collection
   */
  private $subjects;
  
  /** @ORM\Id() @ORM\Column(type="integer") @ORM\GeneratedValue(strategy="AUTO") @var   int */
  protected $_id;
  
  public function __get($property) {
  
      return $this-&gt;$property;
  }
  
  public function __set($property, $value) {
  
      $this-&gt;$property = $value;
  }
  
  //Getters and setters
  
  /** @return Collection */
  public function getSubjects() {
      return $this-&gt;comments;
  }
  
  /** @param Comment $comment */
  public function addSubject(Subject $comment) {
      $this-&gt;comments-&gt;add($comment);
      $comment-&gt;setUser($this);
  }
  </code></pre>
  
  <p>}</p>