title: cake php check if record exist with custom column
body: <p>Is there a way to check if record exist in cake php . I know there is a function .CakePHP 2</p>
  
  <pre><code>$this-&gt;Notes-&gt;id = $id;
  if (!$this-&gt;Notes-&gt;exists())
  {
      throw new NotFoundException(__('Invalid Notes'));
  }
  </code></pre>
  
  <p>but by default it check with the column <code>id</code> How can i check with a custom column suppose it is <code>note_id</code>. my attemts are <a href="https://stackoverflow.com/questions/25065005/check-if-record-exists-in-cakephp3">refer from here</a></p>
  
  <p><strong>attempt #1</strong></p>
  
  <pre><code>if (!$this-&gt;Noteshistory-&gt;exists(['note_id'=&gt;$id]))
  {
      throw new NotFoundException(__("Invalid Note "));
  }
  </code></pre>
  
  <p><strong>also tried to set note_id</strong></p>
  
  <pre><code>$this-&gt;Noteshistory-&gt;note_id = $id;
  if (!$this-&gt;Noteshistory-&gt;exists(['note_id'=&gt;$id]))
      {
          throw new NotFoundException(__("Invalid Note "));
      }
  </code></pre>
  
  <p>but no luck .</p>