Commits

Bogdan Savluk committed 3f24c15

fixed crash when some i18n model do not exists

Comments (0)

Files changed (1)

GalleryManager.php

         foreach ($this->gallery->galleryPhotos as $photo) {
             $i18ns = array();
             foreach (Yii::app()->params['languages'] as $lang) {
-                $i18ns[$lang] = array(
-                    'name' => (string)$photo->i18ns[$lang]->name,
-                    'description' => (string)$photo->i18ns[$lang]->description,
-                    'link' => (string)$photo->i18ns[$lang]->link,
-                );
+                if(isset($photo->i18ns[$lang])){
+                    $i18ns[$lang] = array(
+                        'name' => (string)$photo->i18ns[$lang]->name,
+                        'description' => (string)$photo->i18ns[$lang]->description,
+                        'link' => (string)$photo->i18ns[$lang]->link,
+                    );
+                } else {
+                    $i18ns[$lang] = array(
+                        'name' => '',
+                        'description' => '',
+                        'link' => '',
+                    );
+                }
             }
             $photos[] = array(
                 'id' => $photo->id,