title: Symfony2 getId non-object error
body: <p>Hy everybody, i've got a problem with my Bundle when I'm trying to obtain the ID of an user.</p>
  
  <pre><code>$user = $userManager-&gt;findUserById($tmpID['uid']);
  </code></pre>
  
  <p>Where <b>$tmpID['uid']</b> is the ID of the user and when I'm trying to to $user->getId() I obtain an error.</p>
  
  <p>This is the error</p>
  
  <pre><code>FatalErrorException: Error: Call to a member function getId() on a non-object in /Applications/MAMP/htdocs/Api/src/Api/ApiBundle/Controller/DefaultController.php line 263
  </code></pre>
  
  <p>MyBundle\Entity\User.php</p>
  
  <pre><code>&lt;?php
  
  namespace MyBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use FOS\UserBundle\Entity\User as BaseUser;
  
   /**
   * @ORM\Entity
   * @ORM\Table(name="user")
   */
  
  class User extends BaseUser
  {
  /**
   * @ORM\Id
   * @ORM\Column(type="integer")
   * @ORM\GeneratedValue(strategy="AUTO")
   *
   */
  protected $id;
  
  /**
   * @var string
   *
   * @ORM\Column(name="description", type="text", nullable=true)
   */
  protected $description;
  
  
  /**
   * @var integer
   *
   * @ORM\Column(name="genre", type="integer", nullable=false)
   */
  protected $genre;
  
  
  /**
   * @var string
   *
   * @ORM\Column(name="device", type="string", nullable=true)
   */
  protected $device;
  
  
  /**
   * @var string
   *
   * @ORM\Column(name="avatar", type="string", nullable=true)
   */
  protected $avatar;
  
  /**
   * @var string
   *
   * @ORM\Column(name="phone", type="integer", nullable=true)
   */
  protected $phone;
  
  public function __construct()
  {
      parent::__construct();
      // your own logic
  }
  
  public function getDescription() {
      return $this-&gt;description;
  }
  
  public function setDescription($description) {
      $this-&gt;description = $description;
  }
  
  public function getGenre() {
      return $this-&gt;genre;
  }
  
  public function setGenre($genre) {
      $this-&gt;genre = $genre;
  }
  
  public function getDevice() {
      return $this-&gt;device;
  }
  
  public function setDevice($device) {
      $this-&gt;device = $device;
  }
  
  
  public function getPhone() {
      return $this-&gt;phone;
  }
  
  public function setPhone($phone) {
      $this-&gt;phone = $phone;
  }
  
  public function getAvatar() {
      return $this-&gt;avatar;
  }
  
  public function setAvatar($avatar) {
      $this-&gt;avatar = $avatar;
  }
  
  }
  </code></pre>