public function index()
{
$this->layout = 'favorite';
$favorites = Cache::read('new_favorites', '_cake_model_');
if (!$favorites) {
$this->Favorite->recursive = 0;
$favorites = $this->Favorite->find('all', array(
'conditions' => array(
'Favorite.in_trash' => false,
'Favorite.user_id' => $this->Auth->user('id'),
),
'order' => array(
'Favorite.ordenation' => 'ASC',
'Favorite.name' => 'DESC',
),
'limit' => 100
));
Cache::write('new_favorites', $favorites, '_cake_model_');
}
$this->set('favorites', $favorites);
}