title: lazy loading with doctrine one to one mapping
body: <p>I am having a hard time finding the correct result for this.</p>
  
  <p>I have one to one mapping. There are two tables:</p>
  
  <pre><code>/**
  * @ORM\Table(name="users")
  * @ORM\Entity
  */
  class Users {
  
     /**
      * @ORM\OneToOne(targetEntity="UsersSettings", mappedBy="user",cascade={"persist"})
     */
     private $userSetting;
  
     //getters and setters
  }
  
  /**
  * @ORM\Table(name="notifications_settings")
  * @ORM\Entity
  */
  class UsersSettings {
  
     /**
     * @var Users
     *
     * @ORM\OneToOne(targetEntity="Users", inversedBy="userSetting")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="user_id", referencedColumnName="id")
     * })
     */
     private $user;
  }
  </code></pre>
  
  <p>Whenever I fetch entity one as below:</p>
  
  <pre><code>$q = $this
              -&gt;createQueryBuilder('u')
              -&gt;select('u, r')
              -&gt;leftJoin('u.roles', 'r')
              -&gt;where('u.username = :username OR u.email = :email')
              -&gt;setParameter('username', $username)
              -&gt;setParameter('email', $username)
              -&gt;getQuery();
  </code></pre>
  
  <p>Doctrine immediately performs join to usersSettings entity which I dont want:</p>
  
  <blockquote>
    <p>SELECT t0.id AS id1, t0.username AS username2, t0.email AS email3, t0.password AS password4, t29.id AS id30, t29.is_notify_by_email AS
    is_notify_by_email31, t29.user_id AS user_id32 FROM users t0 LEFT JOIN
    users_settings t29 ON t29.user_id = t0.id WHERE t0.id = ?</p>
  </blockquote>
  
  <p>Other types of mapping like <code>OneToMany</code> and <code>ManyToOne</code> performs lazy loading but in case of one to one mapping, I could not configure to lazy load. How can I lazy load this relation? I am using doctrine 2.3 and Symfony 2.1</p>