Browse Source

prevent no tag data user

Bastien Sevajol 9 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
   
9
   
10
   public function getTagOrderForFavorites(User $user)
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
    if (count($tags_ordereds = $user_tags->getElementFavoriteTags()))
16
    if (count($tags_ordereds = $user_tags->getElementFavoriteTags()))
15
      return $tags_ordereds;
17
      return $tags_ordereds;
19
   
21
   
20
   public function getTagOrderForDiffusions(User $user)
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
    if (count($tags_ordereds = $user_tags->getElementDiffusionTags()))
28
    if (count($tags_ordereds = $user_tags->getElementDiffusionTags()))
25
      return $tags_ordereds;
29
      return $tags_ordereds;