PHP warning

max() [<a href='function.max'>function.max</a>]: Array must contain at least one element

/var/www/u0040278/data/www/donkihot.ru/protected/controllers/AboutAjaxController.php(19)

07     public $nextMin;
08     public $nextMax;
09     public $nextMinF;
10     public $nextMaxF;
11     public $setIdMax;
12     public $tralala;
13     public $yearId;
14     
15     public function actionNovosti($id) {
16         
17                 $deviation = 10;
18                 $model=AboutHotelNovosti::model()->findAll();
19                 $maxKey = max(array_keys($model));
20                     if ($id==1){
21                         
22                         
23                         $this->nextMinF = $maxKey - $deviation;
24                         $this->nextMaxF = $maxKey + $deviation;
25                         foreach ($model as $key => $value) {
26                             if ($key > $maxKey - $deviation){
27                                $setId[] =  $value;
28                             }
29                             if ($key == $this->nextMinF){
30                                 $setIdMin[] = $value;
31                             }

Stack Trace

#0
+
 /var/www/u0040278/data/www/donkihot.ru/protected/controllers/AboutAjaxController.php(19): max(array())
14     
15     public function actionNovosti($id) {
16         
17                 $deviation = 10;
18                 $model=AboutHotelNovosti::model()->findAll();
19                 $maxKey = max(array_keys($model));
20                     if ($id==1){
21                         
22                         
23                         $this->nextMinF = $maxKey - $deviation;
24                         $this->nextMaxF = $maxKey + $deviation;
#7
+
 /var/www/u0040278/data/www/donkihot.ru/protected/modules/rights/components/RController.php(50): CFilter->filter(CFilterChain)
45     }
46     
47     public function filterRights($filterChain) {
48         $filter = new RightsFilter;
49         $filter->allowedActions = $this->allowedActions();
50         $filter->filter($filterChain);
51     }
52 
53     /**
54      * @return string the actions that are always allowed separated by commas.
55      */
#15
+
 /var/www/u0040278/data/www/donkihot.ru/www/index.php(17): CApplication->run()
12 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
13 
14 require_once($yii);
15 Yii::setPathOfAlias('root', $root);
16 Yii::setPathOfAlias('bootstrap', $root . DS . 'protected' . DS . 'extensions' . DS . 'bootstrap');
17 Yii::createWebApplication($config)->run();
2024-03-29 14:13:55 Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_fcgid/2.3.9 Phusion_Passenger/5.3.7 Yii Framework/1.1.14