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';
精彩评论