Sayfalar

22 Ağustos 2016 Pazartesi

call own model,other models and components from controller


cakephp 2.8 

ExamsController.php

var $uses = array(
     
    'Vexam', //other model
     'Exam' //own model
);

public $components = array('Export');
call other model

$ids_eq_categories= $this->Vexam->find('first', array(
       'conditions'=>array('exam_id'=>$sinav_id,
       'eqcategorie_id'=> $category_id),
       'fields'=>array('id')
));
call own model

$ids_eq_categories= $this->Exam->find('first', array(
       'conditions'=>array('exam_id'=>$sinav_id,
       'eqcategorie_id'=> $category_id),
       'fields'=>array('id')
));
call components
$this->Export->exportData();// exportdata is component function

-------------------------------------------------------------
ExamsController.php

own model

$ids_eq_categories= $this->find('first', array(
       'conditions'=>array('exam_id'=>$sinav_id,
       'eqcategorie_id'=> $category_id),
       'fields'=>array('id')
));

Hiç yorum yok:

Yorum Gönder