cakephpcakephp-2.2

Using Model in routes file, cakephp


I am looking to load values from my database in my /app/Config/routes.php configuration file.

At the top I am using: App::uses('Option', 'Model');

And I am calling my find in my class: $this->Option->find('all');

Am I missing something?


Solution

  • I think you have to instantiate the model before you use it:

    App::uses('Option', 'Model');
    $option = new Option();
    $something = $option->find('all');