title: Entity relationship showing "Entity not Found" when relation with two different vendor's bundle in Symfony2
body: <p>I have created two bundle using two different vendor names. Two bundle names is-</p>
  
  <ul>
  <li><strong>SystemUsersBundle</strong>
  
  <ul>
  <li><strong>Namespace</strong>= SystemUsersBundle\<strong>Namespace</strong></li>
  </ul></li>
  <li><strong>AppBundle</strong>
  
  <ul>
  <li><strong>Namespace</strong>= AppBundle\<strong>Namespace</strong></li>
  </ul></li>
  </ul>
  
  <p>Now, I have created two Entity inside two bundle. Entity name given below-</p>
  
  <ul>
  <li><strong>Comment.php</strong> – this entity created under AppBundle and it’s namespace
  is AppBundle\Entity.</li>
  <li><strong>Users.php</strong> – this entity created under SystemUsersBundle and it’s
  namespace is SystemUsersBundle\Entity.</li>
  </ul>
  
  <p><strong>My directory Structure is-</strong></p>
  
  <p><img src="https://i.stack.imgur.com/ZcaMx.jpg" alt="enter image description here"></p>
  
  <p>Now, I wanted to make a relationship between Users.php and Comment.php entity. For this purpose I make a relation between them according to the rule of Doctrine ManyToOne relationship.</p>
  
  <p>Users.php and Comment.php file given below-</p>
  
  <p><strong>Users.php</strong></p>
  
  <pre><code>&lt;?php
  
  namespace SystemUsersBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use Symfony\Component\Security\Core\User\AdvancedUserInterface;
  use Gedmo\Mapping\Annotation as Gedmo;
  
  /**
   * Users
   *
   * @ORM\Table("users")
   */
  class Users implements AdvancedUserInterface
  {
  
      /**
       * @var integer
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var string
       *
       * @ORM\Column(name="username", type="string", length=255)
       */
      private $username;
  
      /**
       * @var string
       *
       * @ORM\Column(name="name", type="string", length=255)
       */
      private $name;
  
      /**
       * @var string
       *
       * @ORM\Column(name="email", type="string", length=255)
       */
      private $email;
  
      /**
       * @Gedmo\Slug(fields={"name"}, updatable=false)
       * @ORM\Column(length=255, unique=true)
       */
      private $slug;
  
      /**
       * @var string
       *
       * @ORM\Column(name="salt", type="string", length=255)
       */
      private $salt;
  
      /**
       * @var string
       *
       * @ORM\Column(name="password", type="string", length=255)
       */
      private $password;
  
      /**
       * @var string
       */
      private $plainpassword;
  
      /**
       * @var string
       */
      private $resetPassword;
  
      /**
       * @var array
       *
       * @ORM\Column(name="roles", type="array")
       */
      private $roles = array();
  
      /**
       * @var boolean
       *
       * @ORM\Column(name="app_status", type="boolean")
       */
      private $appStatus;
  
      /**
       * @var boolean
       *
       * @ORM\Column(name="is_active",type="boolean")
       */
      private $isActive;
  
      /**
       * @var \DateTime
       *
       * @ORM\Column(name="created_at", type="datetime")
       */
      private $createdAt;
  
      /**
       * @var \DateTime
       *
       * @ORM\Column(name="updated_at", type="datetime")
       */
      private $updatedAt;
  
      public function __construct()
      {
          $this-&gt;salt = base_convert(sha1(uniqid(mt_rand(), true)), 16, 36);
      }
  
      /**
       * Get id
       *
       * @return integer
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  
      /**
       * Set username
       *
       * @param string $username
       * @return Users
       */
      public function setUsername($username)
      {
          $this-&gt;username = $username;
  
          return $this;
      }
  
      /**
       * Get username
       *
       * @return string
       */
      public function getUsername()
      {
          return $this-&gt;username;
      }
  
      /**
       * Set name
       *
       * @param string $name
       * @return Users
       */
      public function setName($name)
      {
          $this-&gt;name = $name;
  
          return $this;
      }
  
      /**
       * Get name
       *
       * @return string
       */
      public function getName()
      {
          return $this-&gt;name;
      }
  
      /**
       * Set email
       *
       * @param string $email
       * @return Users
       */
      public function setEmail($email)
      {
          $this-&gt;email = $email;
  
          return $this;
      }
  
      /**
       * Get email
       *
       * @return string
       */
      public function getEmail()
      {
          return $this-&gt;email;
      }
  
      /**
       * Set slug
       *
       * @param string $slug
       * @return Users
       */
      public function setSlug($slug)
      {
          $this-&gt;slug = $slug;
  
          return $this;
      }
  
      /**
       * Get slug
       *
       * @return string
       */
      public function getSlug()
      {
          return $this-&gt;slug;
      }
  
      /**
       * Set password
       *
       * @param string $password
       * @return Users
       */
      public function setPassword($password)
      {
          $this-&gt;password = $password;
  
          return $this;
      }
  
      /**
       * Get password
       *
       * @return string
       */
      public function getPassword()
      {
          return $this-&gt;password;
      }
  
      /**
       * Set plainpassword for the application
       *
       * @param type $plainpassword
       */
      function setPlainpassword($plainpassword)
      {
          $this-&gt;plainpassword = $plainpassword;
      }
  
      /**
       * Get plainpassword for the application
       *
       * @return type
       */
      function getPlainpassword()
      {
          return $this-&gt;plainpassword;
      }
  
      /**
       * Set resetPassword for the application
       *
       * @param type $resetPassword
       */
      function setResetPassword($resetPassword)
      {
          $this-&gt;resetPassword = $resetPassword;
      }
  
      /**
       * Get plainpassword for the application
       *
       * @return type
       */
      function getResetPassword()
      {
          return $this-&gt;resetPassword;
      }
  
      /**
       * Set roles
       *
       * @param string $roles
       * @return Users
       */
      public function setRoles($roles)
      {
          $this-&gt;roles = $roles;
  
          return $this;
      }
  
      /**
       * Get roles
       *
       * @return string
       */
      public function getRoles()
      {
          $roles   = $this-&gt;roles;
          $roles[] = 'ROLE_USER';
  
          return array_unique($roles);
      }
  
      /**
       *  set salt property of user
       *
       * @return type
       */
      function getSalt()
      {
          return $this-&gt;salt;
      }
  
      /**
       * Get salt value of user
       *
       * @param type $salt
       */
      function setSalt($salt)
      {
          $this-&gt;salt = $salt;
      }
  
      /**
       * Set appStatus
       *
       * @param boolean $appStatus
       * @return Users
       */
      public function setAppStatus($appStatus)
      {
          $this-&gt;appStatus = $appStatus;
  
          return $this;
      }
  
      /**
       * Get appStatus
       *
       * @return boolean
       */
      public function getAppStatus()
      {
          return $this-&gt;appStatus;
      }
  
      /**
       * Set createdAt
       *
       * @param \DateTime $createdAt
       * @return Users
       */
      public function setCreatedAt($createdAt)
      {
  
          $this-&gt;createdAt = $createdAt;
  
          return $this;
      }
  
      /**
       * Get createdAt
       *
       * @return \DateTime
       */
      public function getCreatedAt()
      {
          return $this-&gt;createdAt;
      }
  
      /**
       * Set updatedAt
       *
       * @param \DateTime $updatedAt
       * @return Users
       */
      public function setUpdatedAt($updatedAt)
      {
          $this-&gt;updatedAt = $updatedAt;
  
          return $this;
      }
  
      /**
       * Get updatedAt
       *
       * @return \DateTime
       */
      public function getUpdatedAt()
      {
          return $this-&gt;updatedAt;
      }
  
      /**
       * Get Is active property
       *
       * @return type
       */
      function getIsActive()
      {
          return $this-&gt;isActive;
      }
  
      /**
       * Set Is active property
       *
       * @param \SystemUsersBundle\Entity\type $isActive
       * @return $users
       */
      function setIsActive($isActive)
      {
          $this-&gt;isActive = $isActive;
          return $this;
      }
  
      /**
       * erase plain password credentials
       */
      public function eraseCredentials()
      {
          $this-&gt;setPlainpassword(null);
      }
  
      /**
       * Checks whether the user's account has expired.
       *
       * Internally, if this method returns false, the authentication system
       * will throw an AccountExpiredException and prevent login.
       *
       * @return bool true if the user's account is non expired, false otherwise
       *
       * @see AccountExpiredException
       */
      public function isAccountNonExpired()
      {
          return true;
      }
  
      /**
       * Checks whether the user is locked.
       *
       * Internally, if this method returns false, the authentication system
       * will throw a LockedException and prevent login.
       *
       * @return bool true if the user is not locked, false otherwise
       *
       * @see LockedException
       */
      public function isAccountNonLocked()
      {
          return true;
      }
  
      /**
       * Checks whether the user's credentials (password) has expired.
       *
       * Internally, if this method returns false, the authentication system
       * will throw a CredentialsExpiredException and prevent login.
       *
       * @return bool true if the user's credentials are non expired, false otherwise
       *
       * @see CredentialsExpiredException
       */
      public function isCredentialsNonExpired()
      {
          return true;
      }
  
      /**
       * Checks whether the user is enabled.
       *
       * Internally, if this method returns false, the authentication system
       * will throw a DisabledException and prevent login.
       *
       * @return bool true if the user is enabled, false otherwise
       *
       * @see DisabledException
       */
      public function isEnabled()
      {
          return $this-&gt;getIsActive();
      }
  </code></pre>
  
  <p><strong>Comment.php</strong></p>
  
  <pre><code>&lt;?php
  
  namespace AppBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use SystemUsersBundle\Entity\Users;
  
  /**
   * Comment
   *
   * @ORM\Table("comment")
   * @ORM\Entity
   */
  class Comment
  {
      /**
       * @var integer
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var string
       *
       * @ORM\Column(name="title", type="string", length=255)
       */
      private $title;
  
      /**
       * @var integer
       *
       * @ORM\Column(name="user_id", type="integer")
       */
      private $userId;
  
      /**
       * @var boolean
       *
       * @ORM\Column(name="status", type="boolean")
       */
      private $status;
  
      /**
       *
       * @ORM\ManyToOne(targetEntity="Users")
       */
      protected $owner;
  
      /**
       * Get id
       *
       * @return integer 
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  
      /**
       * Set title
       *
       * @param string $title
       * @return Comment
       */
      public function setTitle($title)
      {
          $this-&gt;title = $title;
  
          return $this;
      }
  
      /**
       * Get title
       *
       * @return string 
       */
      public function getTitle()
      {
          return $this-&gt;title;
      }
  
      /**
       * Set userId
       *
       * @param integer $userId
       * @return Comment
       */
      public function setUserId($userId)
      {
          $this-&gt;userId = $userId;
  
          return $this;
      }
  
      /**
       * Get userId
       *
       * @return integer 
       */
      public function getUserId()
      {
          return $this-&gt;userId;
      }
  
      /**
       * Set status
       *
       * @param boolean $status
       * @return Comment
       */
      public function setStatus($status)
      {
          $this-&gt;status = $status;
  
          return $this;
      }
  
      /**
       * Get status
       *
       * @return boolean 
       */
      public function getStatus()
      {
          return $this-&gt;status;
      }
  }
  </code></pre>
  
  <p>In comment.php file, make relationship using </p>
  
  <pre><code>    /**
       *
       * @ORM\ManyToOne(targetEntity="Users")
       */
      protected $owner;
  </code></pre>
  
  <p><strong>it's give the following error-</strong></p>
  
  <p><img src="https://i.stack.imgur.com/8wykP.jpg" alt="enter image description here"></p>
  
  <p>But if I wanted make relationship with two entity under same Bundle(like SystemUsersBundle or AppBundle) it works perfectly ok. If you need more information let me know.</p>