title: CakePHP Pagination Count Query Not Working
body: <p>Hello I have relationship in User model Like This.</p>
  
  <p><strong>UserModel</strong></p>
  
  <pre><code>public $hasOne = [
          'Userdetail'  =&gt; [
              'className'    =&gt; 'Userdetail',
              'foreignKey'   =&gt; 'user_id'
          ],
          'Application' =&gt; [
              'className'    =&gt; 'Application',
              'foreignKey'   =&gt; 'user_id'
          ],
      ];
  </code></pre>
  
  <p>I have add extra HasOne Relationship in MyConroller Like below :</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>$this-&gt;User-&gt;bindModel([
              'hasOne' =&gt; [
                  'Events' =&gt; [
                      'className'  =&gt; 'Events',
                      'foreignKey' =&gt; 'user_id',
                      'dependent' =&gt; true,
                  ]
              ]
          ]);
  </code></pre>
  
  <p>I am create a pagination with the User model like below :</p>
  
  <p><strong>Pagination</strong></p>
  
  <pre><code>$this-&gt;paginate = [
              'conditions' =&gt; [
                  $this-&gt;conditions,
                  'Events.id !=' =&gt; null
              ],
              'order' =&gt; 'User.id DESC'
          ];
  </code></pre>
  
  <p>I don't want that record whose event id is null so I put this in pagination condition. Than i got below error.</p>
  
  <pre><code>Unknown column 'Events.id' in 'where clause'
  </code></pre>
  
  <p>Event's model is not reflect in the Count query for the pagination.</p>
  
  <p>Please help me on this concern.</p>
  
  <p>Thanks in advance for helping me.</p>