Gildas Ross
Gildas Ross

Reputation: 3892

Cake PHP Table not found in datasource

I added a table sitewebs in my existing database. So I created a class Model Siteweb :

<?php
App::uses('AppModel', 'Model');
/**
 * Siteweb Model
 *
 */
class Siteweb extends AppModel {
/**
 * Display field
 *
 * @var string
 */
    public $displayField = 'nom';
}

The connection parameters for the database are correct, and the user has all the rights on this table (When I generate the shema via command line php cake.php schema generate -f, although the table appears in the file shema.php).

My Configuration

What I tried to do to solve the problem

But I still have the error Table sitewebs for model Siteweb was not found in datasource default.

Look at the code of my controller :

$this->loadModel('Siteweb');    
try {
        var_dump($this->Siteweb->find('all'));
} catch (Exception $ex) {
        var_dump($ex->getMessage());
}

Except this controller, the application is functional.

Any idea ?

Upvotes: 1

Views: 776

Answers (1)

Gildas Ross
Gildas Ross

Reputation: 3892

Just set debug var to refresh cache files, solve my problem :

Configure::write('debug', 2);

Upvotes: 3

Related Questions