Skip to content
Snippets Groups Projects
Commit e4b3afa3 authored by David Siegfried's avatar David Siegfried
Browse files

fix sql, closes #2870

Closes #2870

Merge request studip/studip!1941
parent 25915ffd
No related branches found
No related tags found
No related merge requests found
...@@ -358,21 +358,16 @@ class StudipStudyArea extends SimpleORMap implements StudipTreeNode ...@@ -358,21 +358,16 @@ class StudipStudyArea extends SimpleORMap implements StudipTreeNode
/** /**
* Search for study areas whose name matches the given search term. * Search for study areas whose name matches the given search term.
* *
* @param string the seach term * @param string $searchTerm the seach term
* *
* @return type <description> * @return StudipStudyArea[] nodes
*/ */
public static function search($searchTerm) public static function search($searchTerm)
{ {
$query = return self::findBySql(
"sem_tree_id IN ( "sem_tree_id IN (SELECT sem_tree_id FROM sem_tree WHERE name LIKE :searchTerm ORDER BY priority)",
SELECT sem_tree_id FROM sem_tree st1 WHERE name LIKE :searchTerm ['searchTerm' => "%$searchTerm%"]
UNION DISTINCT );
SELECT sem_tree_id FROM Institute i
INNER JOIN sem_tree st2 ON st2.studip_object_id = i.Institut_id
WHERE i.Name LIKE :searchTerm )
ORDER BY priority";
return self::findBySql($query, ['searchTerm' => "%$searchTerm%"]);
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment