|
@@ -21,24 +21,28 @@ class UserRepository extends EntityRepository
|
21
|
21
|
$select = 'u';
|
22
|
22
|
$join = '';
|
23
|
23
|
$where = '';
|
|
24
|
+ $order = '';
|
24
|
25
|
$parameters = array('uid' => $user_id);
|
25
|
26
|
|
26
|
27
|
if (in_array('followeds_users', $join_list))
|
27
|
28
|
{
|
28
|
29
|
$select .= ', fdu, fdu_u';
|
29
|
30
|
$join .= ' LEFT JOIN u.followeds_users fdu LEFT JOIN fdu.followed fdu_u';
|
|
31
|
+ $order = $this->updateOrderBy($order, 'fdu_u.username ASC');
|
30
|
32
|
}
|
31
|
33
|
|
32
|
34
|
if (in_array('followers_users', $join_list))
|
33
|
35
|
{
|
34
|
36
|
$select .= ', fru, fru_u';
|
35
|
37
|
$join .= ' LEFT JOIN u.followers_users fru LEFT JOIN fru.follower fru_u';
|
|
38
|
+ $order = $this->updateOrderBy($order, 'fru_u.username ASC');
|
36
|
39
|
}
|
37
|
40
|
|
38
|
41
|
if (in_array('followeds_groups', $join_list))
|
39
|
42
|
{
|
40
|
43
|
$select .= ', fdg, fdg_g';
|
41
|
44
|
$join .= ' LEFT JOIN u.followed_groups fdg LEFT JOIN fdg.group fdg_g';
|
|
45
|
+ $order = $this->updateOrderBy($order, 'fdg_g.name ASC');
|
42
|
46
|
}
|
43
|
47
|
|
44
|
48
|
if (in_array('favorites_tags', $join_list))
|
|
@@ -65,11 +69,27 @@ class UserRepository extends EntityRepository
|
65
|
69
|
$join
|
66
|
70
|
WHERE u.id = :uid
|
67
|
71
|
$where
|
|
72
|
+ $order
|
68
|
73
|
")
|
69
|
74
|
->setParameters($parameters)
|
70
|
75
|
;
|
71
|
76
|
}
|
72
|
77
|
|
|
78
|
+ protected function updateOrderBy($orderBy, $add)
|
|
79
|
+ {
|
|
80
|
+ if (strpos($orderBy, 'ORDER BY') === false)
|
|
81
|
+ {
|
|
82
|
+ $orderBy .= 'ORDER BY ';
|
|
83
|
+ }
|
|
84
|
+
|
|
85
|
+ if ($orderBy !== 'ORDER BY ')
|
|
86
|
+ {
|
|
87
|
+ $orderBy .= ', ';
|
|
88
|
+ }
|
|
89
|
+
|
|
90
|
+ return $orderBy .= $add;
|
|
91
|
+ }
|
|
92
|
+
|
73
|
93
|
/**
|
74
|
94
|
* Retourne les tag id préférés de l'user.
|
75
|
95
|
*
|