Browse Source

prevent no tag data user

Bastien Sevajol 8 years ago
parent
commit
7f337f4a35
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/Muzich/CoreBundle/Mining/Tag/TagData.php

+ 6 - 2
src/Muzich/CoreBundle/Mining/Tag/TagData.php View File

@@ -9,7 +9,9 @@ class TagData extends Base
9 9
   
10 10
   public function getTagOrderForFavorites(User $user)
11 11
   {
12
-    $user_tags = $this->getUserTagsTags($user, 'element_favorite_tags');
12
+    if (!($user_tags = $this->getUserTagsTags($user, 'element_favorite_tags'))) {
13
+        return array();
14
+    }
13 15
     
14 16
    if (count($tags_ordereds = $user_tags->getElementFavoriteTags()))
15 17
      return $tags_ordereds;
@@ -19,7 +21,9 @@ class TagData extends Base
19 21
   
20 22
   public function getTagOrderForDiffusions(User $user)
21 23
   {
22
-    $user_tags = $this->getUserTagsTags($user, 'element_diffusion_tags');
24
+    if (!($user_tags = $this->getUserTagsTags($user, 'element_diffusion_tags'))) {
25
+        return array();
26
+    }
23 27
     
24 28
    if (count($tags_ordereds = $user_tags->getElementDiffusionTags()))
25 29
      return $tags_ordereds;