php - Calling function with return value in cakephp -



php - Calling function with return value in cakephp -

i new cakephp. have problem calling function. here issue.

in contrloller file values using next function

class="lang-php prettyprint-override">public function index() { $conditions = array( 'order' => array('histroy.chat_sk desc') ); $this->set('histroys', $this->histroy->find('all',$conditions)); }

in model file have following,

class="lang-php prettyprint-override">class histroy extends appmodel { public $tableprefix = 'plc_'; public $usetable = 'chat_history'; }

in view file have listed values using foreach() function , follows

class="lang-php prettyprint-override">foreach ($histroys $histroy): $oper_name = $histroy['histroy']['operator_fk']; $operator_email = $histroy['histroy']['email']; endforeach

in opertaor_fk field in history table. need operator name table operators. need phone call function in view.

ex : in core can as,

class="lang-php prettyprint-override">$operator_name = operator_name($fetch['operator_id']);

function should this:

class="lang-php prettyprint-override">function operator_name($id) { // select value matched field in operator homecoming $operator_name; }

in cakephp how can retrieve values.

please help me out prepare this. in advance

follow blog tutorial cake. it'll explain how create associations , relationships between tables allow is want, in nutshell, need create relationship between history , operator models , work there.

php mysql cakephp cakephp-2.3

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -