php - CakePHP call to undefined method stdClass::read() error -


i'm new cakephp , i'm still learning basics, through working in live project , taking cakephp documentations when necessary. currently, i'm having following problem : i've changed database table name , structure, forced change view, controller , model names. after changing names, whenever run index.ctp page, following error:

fatal error: call undefined method stdclass::read() in c:\wamp\www\sdb\app\controllers \home_loan_distributions_details_controller.php on line 32 

previously, view folder named home_loan_distributions, it's renamed home_loan_distributions_details.

my previous controller name home_loan_distributions_controller.php , current name home_loan_distributions_details_controller.php. codes:

class homeloandistributionsdetailscontroller extends appcontroller {          var $name = 'homeloandistributionsdetails';          function index() {             $user = $this->session->read('user');             $user_role = $user['user']['user_role_id'];             $actions = $this->session->read('actions');             $display_actions = array();              foreach ($actions $action) {                 array_push($display_actions, $action['pm_controller_actions']['name']);             }             $this->set('display_actions', $display_actions);             $this->set('user_role', $user_role);               $branch_id = 18;             $this->set('branch_id', $branch_id);             $conditions = array('branch_id' => $branch_id);               $this->set('homeloandistributionsdetails', $this->paginate($conditions));             $this->homeloandistributiondetail->branch->recursive = 0;             $this->set('branchdetailinformation', $this->homeloandistributiondetail->branch->read(array('branch.id', 'branch.name', 'regionaloffice.name', 'districtoffice.name', 'subdistrictoffice.name', 'clusteroffice.name'), $branch_id));         } 

my model named home_loan_distribution.php , it's named home_loan_distribution_detail.php. codes:

class homeloandistributiondetail extends appmodel {      var $name = 'homeloandistributiondetail';     var $actsas = array('logable' => array(             'usermodel' => 'user',             'userkey' => 'user_id',             'change' => 'list', // options 'list' or 'full'             'description_ids' => true // options true or false     ));     var $validate = array(         'entry_date' => array(             'rule' => 'date',             'message' => 'enter valid date',             'allowempty' => true         ),         'branch_id' => array('numeric'),         'customer_id' => array('numeric'),         'loan_amount' => array('numeric'),         'service_charge' => array('numeric'),         'security' => array('numeric'),         'loan_taken_term' => array('numeric'),         'purpose_id' => array('numeric'),         'installment_amount' => array('numeric'),         'installment_service_charge' => array('numeric'),     );      //the associations below have been created possible keys, not needed can removed     var $belongsto = array(         'branch' => array(             'classname' => 'branch',             'foreignkey' => 'branch_id',             'conditions' => '',             'fields' => 'id,name',             'order' => ''         )     );      function paginate($conditions, $fields, $order, $limit, $page = 1, $recursive = null, $extra = array()) {        $recursive = 0;        $group = $fields = array('branch_id', 'entry_date');       $order = array('entry_date desc');       $limit = 4;       $this->paginatecount($conditions);       return $this->find('all', compact('conditions', 'fields', 'order', 'limit', 'recursive', 'group'));       }        function paginatecount($conditions = null, $recursive = 0, $extra = array()) {        $recursive = 0;       $group = $fields = array('branch_id', 'entry_date');       $order = array('entry_date desc');       $results = $this->find('all', compact('conditions', 'fields', 'order', 'limit', 'page', 'recursive', 'group'));       return count($results);       }   } 

what guess is: messed naming conventions while renaming everything. problem within line in controller:

$this->set('branchdetailinformation', $this->homeloandistributiondetail->branch->read(array('branch.id', 'branch.name', 'regionaloffice.name', 'districtoffice.name', 'subdistrictoffice.name', 'clusteroffice.name'), $branch_id)); 

whenever comment out line, stop getting above mentioned error message , view page loads (although still have data missing - because need branch related data displayed in view.) can't figure out problem is, @ least know is. need pinpoint it.

my cakephp version 1.2.5, php version - 5.2

there no function read model.if want find model data try -

$this->set('branchdetailinformation', $this->homeloandistributiondetail->branch->find('all', $consitions); 

$conditions array of requirements want provide. see docs more info.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -