title: CakePHP: get user info in models
body: <p>I'm moving some of my find code inside models.</p>
  
  <p>Previously in my controller I had</p>
  
  <pre><code>$this-&gt;Book-&gt;Review-&gt;find('first', array(
      'conditions' =&gt; array(
          'Review.book_id' =&gt; $id,
          'Review.user_id' =&gt; $this-&gt;Auth-&gt;user('id')
      )
  ));
  </code></pre>
  
  <p>so in my Review model I put something like</p>
  
  <pre><code>function own($id) {
      $this-&gt;contain();
      $review = $this-&gt;find('first', array(
          'conditions' =&gt; array(
              'Review.book_id' =&gt; $id,
              'Review.user_id' =&gt; AuthComponent::user('id')
          )
      ));
      return $review;
  }
  </code></pre>
  
  <p>So I'm calling AuthComponent statically from the Model. I know I can do this for the method AuthComponent::password(), which is useful for validation. But I'm getting errors using the method AuthComponent::user(), in particular</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function
    check() on a non-object in
    /var/www/MathOnline/cake/libs/controller/components/auth.php
    on line 663</p>
  </blockquote>
  
  <p>Is there a way to get the info about the currently logged user from a model?</p>