title: check if id exist in database if not redirect to my add cakephp
body: <p>thanks see I have this problem I want to check if my id (of my user), exist into a other table  if this not exist redirect to my add.</p>
  
  <blockquote>
    <p>table1</p>
  </blockquote>
  
  <h2>| users |</h2>
  
  <p>| id             |</p>
  
  <p>| username       | </p>
  
  <p>| password       | </p>
  
  <p>| creation       |</p>
  
  <p>| type           | </p>
  
  <blockquote>
    <p>table2</p>
  </blockquote>
  
  <h2>|   user_azucar      |</h2>
  
  <p>| id                 |</p>
  
  <p>| id_user            |</p>
  
  <p>| cant               |</p>
  
  <p>| medaza             |</p>
  
  <p>| cachaza            |</p>
  
  <p>I don't want to use hasone because is not for this case. </p>
  
  <p>I want compare id==id_user exist a session for this.
  controller</p>
  
  <pre><code>class IngeniosController extends AppController
  {
      public function add()
      {
  
      }
      public function index()
      {
          $this-&gt;loadModel('Ingenio');
          $conditions = array(
              'conditions' =&gt; array(
                  'UserAzucar.id_user' =&gt; $this-&gt;Session-&gt;read('User.id')
              )
          );
          $result = $this-&gt;User-&gt;find('first', $conditions);
          if (isset($result['User'])){
             $this-&gt;redirect(array('action' =&gt; 'add'));
          }
      }
      public function delete()
      {
  
      }
  }
  </code></pre>
  
  <p>model</p>
  
  <pre><code>&lt;?php
  /**
  * 
  */
  class Ingenio extends AppModel
  {
      public $name = 'UserAzucar';
      public $useTable = 'usuarios_azucar';
      public $primaryKey = 'id_azucarusuario';
  
  }
  ?&gt;
  </code></pre>