How can i convert the following to yii2
$dependency = new CDbCacheDependency('SELECT count(*) FROM job_title');
$jobTitle = JobTitle ::model()->cache(CACHE_TIMEOUT,$dependency)->findAll($array);
$jobTitleList = CHtml::listData($jobTitle, 'job_title_id','desc');
return $jobTitleList;
I have the following code which does not work.
use yii\db\ActiveRecord;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
$items = array();
foreach (Jobsprocess::find()->where($array)->all() as $value) {
$items[$value->process_id] = $value->jobsprocess;
}
return $items;