terrasoff
(Kosta)
1
So, i have cached news in controller
$sql = 'SELECT MAX(updated) FROM `'.Yii::app()->params['cacheTable'].'` WHERE `obj`="'.News::model()->getAttribute('table').'"';
$dependency = new CDbCacheDependency($sql);
$criteria=new CDbCriteria;
$news = News::model()->cache(Yii::app()->params['cacheTime'], $dependency)->find($criteria);
...
works fine!
Watching the sql-log i find query to database:
SELECT MAX(updated) FROM `cache` WHERE `obj`="news"
dependency query, sure!
How can i get the resul of this query in my view-code?
without extra query, of couse…
rtfm
(Hofrob)
2
Do you mean you want to use variables in your view? Take a look at $data in CController.render.
Example
$this->render('index', array(
'news' => $news,
);
Now you can work with $news in your ‘index’-view.
regards, hofrob
terrasoff
(Kosta)
3
i’ve no problems with rendering
i want get result of this query
SELECT MAX(updated) FROM `cache` WHERE `obj`="news"
i need "updated" value
can i get it using $news object?
Haensel
(Johannes)
4
terrasoff
(Kosta)
5
i’m using ActiveRecord
seems it hasn’t binding 
i can do that caching without AR, but it is more comfortable use AR with dependency
mikl
(Mike)
6
Have you tried $dependency->dependentData?