php - Can not load model in controller in CakePHP -


i working in cakephp version 1.3.6. have created controller api in project.

here, have load created 1 model dealpurchase.php , in model have write code like,

<?php    class dealpurchase extends appmodel {       public $actsas = array('containable');       public $belongsto = array('user');   } ?> 

now, in controller(android_controller.php) have write function :

function get_all_deal() {     $this->layout = "";             $this->loadmodel('dealpurchase');     $condition2 = "dealpurchase.deal_status= '0' , dealpurchase.user_id = '45'";     $all_merchant = $this->dealpurchase->find('all',array('conditions'=>$condition2)); } 

when call function page display blank because of error.so problem in code?

you should try debugging here. please sure debugging enabled in config.

$this->loadmodel('dealpurchase');  $condition2 = array(    "dealpurchase.deal_statue=0",     "dealpurchase.user_id = 45" );  $all_merchant = $this->dealpurchase->find('all',array(     'conditions' => $condition2 ));  debug($all_merchant);       // see what's being printed. exit; 

on side note, i'd suggest upgrade @ least cakephp 2, version 3 has been running year.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -