1
0
mirror of synced 2025-01-06 17:17:10 +03:00

added getWords()

This commit is contained in:
zYne 2007-11-18 17:44:47 +00:00
parent 309c2936f7
commit 7af31c0c51

View File

@ -42,6 +42,8 @@ class Doctrine_Search_Query
protected $_params = array(); protected $_params = array();
protected $_words = array();
protected $_condition; protected $_condition;
@ -195,24 +197,31 @@ class Doctrine_Search_Query
} }
return $where; return $where;
} }
public function parseWord($word) public function parseWord($word)
{ {
$this->_words[] = str_replace('*', '', $word);
if (strpos($word, '?') !== false || if (strpos($word, '?') !== false ||
strpos($word, '*') !== false) { strpos($word, '*') !== false) {
$word = str_replace('*', '%', $word); $word = str_replace('*', '%', $word);
$where = 'keyword LIKE ?'; $where = 'keyword LIKE ?';
$params = array($word); $params = array($word);
} else { } else {
$where = 'keyword = ?'; $where = 'keyword = ?';
} }
$this->_params[] = $word; $this->_params[] = $word;
return $where; return $where;
} }
public function getWords()
{
return $this->_words;
}
public function getParams() public function getParams()
{ {
return $this->_params; return $this->_params;