|
@@ -31,11 +31,7 @@ class ElementRepository extends EntityRepository
|
31
|
31
|
* @return Doctrine\ORM\Query
|
32
|
32
|
*/
|
33
|
33
|
public function findBySearch(ElementSearcher $searcher)
|
34
|
|
- {
|
35
|
|
- $query_select = "e, et, t";
|
36
|
|
- $query_join = "e.type et JOIN e.tags t";
|
37
|
|
- $query_where = "";
|
38
|
|
- $query_with = "WITH ";
|
|
34
|
+ {;
|
39
|
35
|
$params = array();
|
40
|
36
|
|
41
|
37
|
switch ($searcher->getNetwork())
|
|
@@ -49,6 +45,7 @@ class ElementRepository extends EntityRepository
|
49
|
45
|
break;
|
50
|
46
|
}
|
51
|
47
|
|
|
48
|
+ $query_with = "WITH ";
|
52
|
49
|
foreach ($searcher->getTags() as $tag)
|
53
|
50
|
{
|
54
|
51
|
if ($query_with != "WITH ")
|
|
@@ -59,15 +56,18 @@ class ElementRepository extends EntityRepository
|
59
|
56
|
$params['tagid'.$tag->getId()] = $tag->getId();
|
60
|
57
|
}
|
61
|
58
|
|
62
|
|
- $query_string = "SELECT $query_select
|
|
59
|
+ $query_join2 = ' JOIN e.owner';
|
|
60
|
+
|
|
61
|
+ $query_string = "SELECT e, et, t, eu
|
63
|
62
|
FROM MuzichCoreBundle:Element e
|
64
|
|
- JOIN $query_join $query_with
|
65
|
|
- ORDER BY e.date_added DESC"
|
|
63
|
+ JOIN e.type et JOIN e.tags t $query_with JOIN e.owner eu
|
|
64
|
+ ORDER BY e.date_added DESC "
|
66
|
65
|
;
|
67
|
66
|
|
68
|
67
|
$query = $this->getEntityManager()
|
69
|
68
|
->createQuery($query_string)
|
70
|
69
|
->setParameters($params)
|
|
70
|
+ ->setMaxResults($searcher->getCount())
|
71
|
71
|
;
|
72
|
72
|
|
73
|
73
|
return $query;
|