Ankit
Ankit

Reputation: 233

CakePHP database table for model was not found in datasource default

I am migrating a cakephp1.3 application in cakephp 2.x. Midway through development, I suddenly found myself with a "table not found" error.

In cakephp 1.3 lower case format for ,file name & also allow underscore between two words But as I have read documentation now only CAMEL format has allowed for naming convention.

I have a db file name "case__studies" previously we were using models/case_study.php

<?php

class Case_Study extends AppModel {

var $name = 'Case_Study';

var $actsAs = array('Multivalidatable');
var $belongsTo = array('User');


}

?>

but now according to new structure I have changed name of file Model/CaseStudy.php

and code for this file

<?php
App::uses('AppModel', 'Model');
class CaseStudy extends AppModel {

    var $name = 'CaseStudy';

    var $actsAs = array('Multivalidatable');
    var $belongsTo = array('User');



}

?>

Upvotes: 1

Views: 2018

Answers (1)

raph
raph

Reputation: 163

Make sure that you cleared/disabled cache after any changes in the model layer.

You won't need that "name" property.

Upvotes: 1

Related Questions