开发者

Notice (8): Undefined property:

Please help me with this: am I missing something?

I am getting following error:

Notice (8): Undefined property: Property::$Project [APP\controllers\properties_controller.php, line 614]

// This is code where warning occurs

$projects = $this->Property->Project->find('list');

and in project.php (model file)

var $hasMany = array(
    'Property' => array(
        'className' => 'Property',
        'foreignKey' => 'project_id',
        'dependent' => true,
        'conditio开发者_Go百科ns' => '',
        'fields' => '',
        'order' => '',
        'limit' => '',
        'offset' => '',
        'exclusive' => '',
        'finderQuery' => '',
        'counterQuery' => ''
    )
);


Add in property.php var $belongsTo = 'Project'.


you have to write in properties_controller.php

var $uses = array('Project');

then you use

$projects = $this->Project->find('list');

Also add in property.php

var $belongsTo = 'Project';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜