title: CakePHP 2 - Why am i getting sql error in model function?
body: <p>I am trying to do the simplest call through my controller and model, but it doesn't work. </p>
  
  <p>The error I get is:</p>
  
  <blockquote>
    <p>Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You
    have an error in your SQL syntax; check the manual that corresponds to
    your MySQL server version for the right syntax to use near
    'ppLongerFunction2' at line 1</p>
  </blockquote>
  
  <p>The controller code is:</p>
  
  <pre><code>&lt;?php
  
  class UsersController extends AppController{
  public $uses = array('User');
  
  function test(){
      $blah = $this-&gt;User-&gt;find('all');
      $u = $this-&gt;User-&gt;ppLongerFunction2();
      $this-&gt;set(compact('blah', 'u'));
  }
  }
  </code></pre>
  
  <p>And the Model is:</p>
  
  <pre><code>&lt;?php
  class User extends AppModel{
  public var $name = 'User';
  var $displayField = 'username';
  
  var $useTable = 'users';
  
  public function ppLongerFunction2(){
      $something = $this-&gt;find('all');
      return $something;
  }
  }
  </code></pre>
  
  <p>Where am I messing up?</p>
  
  <p>Stack Trace:</p>
  
  <pre><code>#0 C:\wamp\www\lib\Cake\Model\Datasource\DboSource.php(436): PDOStatement-&gt;execute(Array)
  #1 C:\wamp\www\lib\Cake\Model\Datasource\DboSource.php(403): DboSource-&gt;_execute('ppLongerFunctio...', Array)
  #2 C:\wamp\www\lib\Cake\Model\Datasource\DboSource.php(647): DboSource-&gt;execute('ppLongerFunctio...', Array, Array)
  #3 C:\wamp\www\lib\Cake\Model\Datasource\DboSource.php(589): DboSource-&gt;fetchAll('ppLongerFunctio...', Array, Array)
  #4 C:\wamp\www\lib\Cake\Model\Model.php(720): DboSource-&gt;query('ppLongerFunctio...', Array, Object(AppModel))
  #5 C:\wamp\www\app\Controller\UsersController.php(11): Model-&gt;__call('ppLongerFunctio...', Array)
  #6 C:\wamp\www\app\Controller\UsersController.php(11): AppModel-&gt;ppLongerFunction2()
  #7 [internal function]: UsersController-&gt;test()
  #8 C:\wamp\www\lib\Cake\Controller\Controller.php(473): ReflectionMethod-&gt;invokeArgs(Object(UsersController), Array)
  #9 C:\wamp\www\lib\Cake\Routing\Dispatcher.php(104): Controller-&gt;invokeAction(Object(CakeRequest))
  #10 C:\wamp\www\lib\Cake\Routing\Dispatcher.php(86): Dispatcher-&gt;_invoke(Object(UsersController), Object(CakeRequest), Object(CakeResponse))
  #11 C:\wamp\www\app\webroot\index.php(96): Dispatcher-&gt;dispatch(Object(CakeRequest), Object(CakeResponse))
  #12 {main}
  </code></pre>
  
  <hr>
  
  <p>All fixed. It was a file-name. Thanks for the help :| stupid</p>