0
版CakePHPのv3.4.71146表は、CakePHP 3
QLSTATE [42S02]でカスタムテーブル名に存在しない:ベーステーブルまたはビューが見つかりません:1146表 'DB.notifications' doesnの
私はスペイン語でテーブル名を持っています。私はモデルとマイコンを英語で使いたいと思います。
$this->table('notificaciones');
だから私はそれは私が別の名前を使用することができるし、他のすべてで十分だと思う:私はすでに次の行を設定している私のNotificationsTableクラスに
。
これは私のNotificationsTable
class NotificationsTable extends Table
{
public function initialize(array $config)
{
parent::initialize($config);
$this->table('notificaciones');
$this->primaryKey('notificaciones_id');
}
public function validationDefault(Validator $validator)
{
$validator
->add('notificaciones_id', 'valid', ['rule' => 'numeric'])
->allowEmpty('notificaciones_id', 'create');
return $validator;
}
public function buildRules(RulesChecker $rules)
{
$rules->add($rules->existsIn(['cola_id'], 'Colas'));
return $rules;
}
}
であり、これは私のコントローラである:私はちょうど
$this->table('notificaciones');
を設定すると、それは十分だったと私は別のモデルを使用することができることを考え
class NotificationsController extends AppController
{
public function index()
{
$this->paginate['contain'] = ['Colas'];
$notifications = $this->paginate($this->Notifications);
$this->set(compact('notifications'));
$this->set('_serialize', ['notifications']);
}
}
とコントローラ名で、私のテーブルと同じ名前ではありません。
誰かが何が起こったのか考えていますか?