我有一个名为" Specialite"我想在MissionController操作中加载它,但它没有工作。
我将此代码$this->loadModel('Specialite');
放在操作中,当我进行调试时:debug($this->Specialite->find('all'));
没有数据返回!!
虽然DB中的表专用包含数据..
这是Specialite的Model类:
<?php
App::uses('AppModel', 'Model');
/**
* Specialite Model
*
* @property Filiale $Filiale
* @property Formation $Formation
* @property Laboratoire $Laboratoire
*/
class Specialite extends AppModel {
/**
* Validation rules
*
* @var array
*/
public $displayField = 'nom';
public $validate = array(
'nom' => array(
'notempty' => array(
'rule' => array('notempty'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
);
//The Associations below have been created with all possible keys, those that are not needed can be removed
/**
* hasMany associations
*
* @var array
*/
public $hasMany = array(
'Filiale' => array(
'className' => 'Filiale',
'foreignKey' => 'specialite_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'Formation' => array(
'className' => 'Formation',
'foreignKey' => 'specialite_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'Laboratoire' => array(
'className' => 'Laboratoire',
'foreignKey' => 'specialite_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'Client' => array(
'className' => 'Client',
'foreignKey' => 'client_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);
}
当我加载其他模型时find()
工作得很好!!只有和#34; Specialite&#34;模特它拒绝工作! :&#39;(
我真的需要帮助!提前谢谢!
答案 0 :(得分:0)
如果设置为0,请检查Config / core.php中的调试模式,然后将其更改为1,如下所示: -
Configure::write('debug', 1);