|
@@ -83,8 +83,6 @@ class ElementRepository extends EntityRepository
|
83
|
83
|
));
|
84
|
84
|
|
85
|
85
|
// On récupère les ids des elements correspondants
|
86
|
|
- //$where_string = "WHERE 1 = 2";
|
87
|
|
- //$params_string = array();
|
88
|
86
|
$word_min_length = 0;
|
89
|
87
|
if (isset($params['word_min_length']))
|
90
|
88
|
{
|
|
@@ -94,50 +92,21 @@ class ElementRepository extends EntityRepository
|
94
|
92
|
{
|
95
|
93
|
if (strlen($word) >= $word_min_length)
|
96
|
94
|
{
|
97
|
|
- $where_string = ($is_where) ? ' AND (' : ' WHERE (';
|
98
|
|
- $is_where = true;
|
99
|
|
- if ($where_string === ' AND (' || $where_string === ' WHERE (')
|
|
95
|
+ if ($where_string === '')
|
100
|
96
|
{
|
|
97
|
+ $where_string = ($is_where) ? ' AND (' : ' WHERE (';
|
|
98
|
+ $is_where = true;
|
101
|
99
|
$where_string .= "UPPER(e_.name) LIKE :str".$i;
|
102
|
100
|
}
|
103
|
101
|
else
|
104
|
102
|
{
|
105
|
103
|
$where_string .= " OR UPPER(e_.name) LIKE :str".$i;
|
106
|
104
|
}
|
107
|
|
- //$params_string['str'.$i] = '%'.strtoupper($word).'%';
|
108
|
105
|
$params_ids['str'.$i] = '%'.strtoupper($word).'%';
|
109
|
106
|
}
|
110
|
107
|
}
|
111
|
108
|
$where_string .= ')';
|
112
|
109
|
|
113
|
|
-// $ids_query = $this->getEntityManager()
|
114
|
|
-// ->createQuery("SELECT e.id FROM MuzichCoreBundle:Element e
|
115
|
|
-// $where_string
|
116
|
|
-// GROUP BY e.id
|
117
|
|
-// ORDER BY e.created DESC, e.id DESC
|
118
|
|
-// ")->setParameters($params_string)
|
119
|
|
-// ;
|
120
|
|
-//
|
121
|
|
-// $ids_query->setMaxResults($searcher->getCount());
|
122
|
|
-// $ids_result = $ids_query->getScalarResult();
|
123
|
|
-//
|
124
|
|
-// $ids = array();
|
125
|
|
-// foreach ($ids_result as $id_record)
|
126
|
|
-// {
|
127
|
|
-// $ids[] = $id_record['id'];
|
128
|
|
-// }
|
129
|
|
-//
|
130
|
|
-// if (count($ids))
|
131
|
|
-// {
|
132
|
|
-// if (($id_limit = $searcher->getIdLimit()))
|
133
|
|
-// {
|
134
|
|
-// $this->getSelectElementForSearchQuery($params_select, $user_id, $ids, $id_limit);
|
135
|
|
-// }
|
136
|
|
-// return $this->getSelectElementForSearchQuery($params_select, $user_id, $ids);
|
137
|
|
-// }
|
138
|
|
-// return $query = $this->getEntityManager()
|
139
|
|
-// ->createQuery("SELECT e FROM MuzichCoreBundle:Element e WHERE 1 = 2")
|
140
|
|
-// ;
|
141
|
110
|
}
|
142
|
111
|
|
143
|
112
|
|