Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
查找未给出结果的查询&;还包括“警告模式”;X";与“模型”不关联;“是”;[APP/Model/Behavior/ContainableBehavior.php,第342行]_Php_Cakephp_Model - Fatal编程技术网

查找未给出结果的查询&;还包括“警告模式”;X";与“模型”不关联;“是”;[APP/Model/Behavior/ContainableBehavior.php,第342行]

查找未给出结果的查询&;还包括“警告模式”;X";与“模型”不关联;“是”;[APP/Model/Behavior/ContainableBehavior.php,第342行],php,cakephp,model,Php,Cakephp,Model,大家好,我们正在尝试将我们的Cakephp 1.3代码迁移到Cakephp 2.x。在这里,我们收到了与模型关联相关的警告,我无法解决这个问题 当我使用旧查询获取关联模型(相关数据库表)的数据时 我们收到了一些警告 Warning (512): Model "User" is not associated with model "UserReference" [APP/Model/Behavior/ContainableBehavior.php, line 342] Warning (512):

大家好,我们正在尝试将我们的Cakephp 1.3代码迁移到Cakephp 2.x。在这里,我们收到了与模型关联相关的警告,我无法解决这个问题

当我使用旧查询获取关联模型(相关数据库表)的数据时

我们收到了一些警告

Warning (512): Model "User" is not associated with model "UserReference" [APP/Model/Behavior/ContainableBehavior.php, line 342]
Warning (512): Model "User" is not associated with model "UserImage" [APP/Model/Behavior/ContainableBehavior.php, line 342]
Warning (512): Model "User" is not associated with model "Testimonial" [APP/Model/Behavior/ContainableBehavior.php, line 342]
结果数据的数组是这样空白的

Array
(
[965] => Array
    (
    )

[851] => Array
    (
    )

[769] => Array
    (
    )

[734] => Array
    (
    )

[657] => Array
    (
    )

)
我们的用户模型类代码:

class User extends AppModel {

var $name = 'User';

var $actsAs = array(
    'Multivalidatable'
);
var $hasOne = array(
    'UserReference' => array(
        'className' => 'UserReference',
        'foriegnKey' => 'user_id',
        'dependent' => true
    )
  );
var $hasMany = array(
    'UserImage' => array(
        'className' => 'UserImage',
        'foriegnKey' => 'user_id',
        'dependent' => true
    ),
   'Testimonial' => array(
        'className' => 'Testimonial',
        'foriegnKey' => 'user_id',
        'dependent' => true
    )
);....
我们的用户参考模型:

class UserReference extends AppModel {

var $name = 'UserReference';

var $actsAs = array('Multivalidatable');
var $belongsTo = array('User');
var $validationSets = array(
    'admin' => array(
        'first_name' => array(
            'notEmpty' => array(
                'rule' => 'notEmpty',
                'message' => 'First name is required.'
            )
        ),
        'last_name' => array(
            'notEmpty' => array(
                'rule' => 'notEmpty',
                'message' => 'Last name is required.'
            )
        ),....
我们的推荐模型课程:

class Testimonial extends AppModel {

var $name = 'Testimonial';

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

}

我的问题可能很傻,但我正试图解决它,但没有得到解决,所以需要帮助。谢谢…

我已经解决了我的问题,实际上我在find查询中的全局变量(Configure::read('App.Role.Mentor'))没有得到任何查询没有结果的值

谢谢

class Testimonial extends AppModel {

var $name = 'Testimonial';

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

}