string = $string; } public function getString() { return $this->string; } /** * @see SearcherInterface * * @return array */ public function getParams() { return array( 'string' => $this->string ); } /** * Retourne les user et groupes correspondant a la recherche * * @param Registry $doctrine * @return array */ public function getResults(Registry $doctrine) { // On remplace le caratcère '%' au cas ou un malin l'insére. $string = str_replace('%', '#', $this->string); $users = $doctrine ->getRepository('MuzichCoreBundle:User') ->findByString($string) ->execute() ; $groups = $doctrine ->getRepository('MuzichCoreBundle:Group') ->findByString($string) ->execute() ; return array( 'users' => $users, 'groups' => $groups ); } }