Php symfony 1.4条令显示使用点字符进行查询时出错

Php symfony 1.4条令显示使用点字符进行查询时出错,php,doctrine,symfony-1.4,Php,Doctrine,Symfony 1.4,我将symfony 1.4与条令一起使用,当搜索词包含该点时,我遇到了这个问题(例如:“V-5.26 3.15”): 找不到类“%V-5” 这是我的密码 $products = Doctrine_Query::create() ->select('t.name,p.price,p.id,pi.immagine,p.offer,p.special,t.description') ->from('Products p')

我将symfony 1.4与条令一起使用,当搜索词包含该点时,我遇到了这个问题(例如:“V-5.26 3.15”):

找不到类“%V-5”

这是我的密码

$products = Doctrine_Query::create()
              ->select('t.name,p.price,p.id,pi.immagine,p.offer,p.special,t.description')
              ->from('Products p')
              ->leftJoin('p.ProductsImages pi')
              ->leftJoin('p.Translation t WITH t.lang = ?', $this->getUser()->getAttribute('current_lang'))
              ->where('p.active = ?', '1')
              ->andWhere('pi.ordine = ?', 0);
$term = explode(' ', $request['term']);
$ricerca = '';
for($i=0; $i < count($term); $i++) {
  $products->andWhere(' t.name LIKE "%'. $term[$i] .'%" OR t.description LIKE "%'. $term[$i] .'%" ');
}
$products->orderBy('t.name');
$this->pager = new sfDoctrinePager('Products', sfConfig::get('app_max_page_products'));
$this->pager->setQuery($products);
$this->pager->setPage($request->getParameter('page', 1));
$this->pager->init();

$term = explode(' ', $request['term']);
$ricerca = '';
for($i=0; $i < count($term); $i++) {
  $products->andWhere(' t.name LIKE "%'. $term[$i] .'%" OR t.description LIKE "%'. $term[$i] .'%" ');
}
$products->orderBy('t.name');
$this->pager = new sfDoctrinePager('Products', sfConfig::get('app_max_page_products'));
$this->pager->setQuery($products);
$this->pager->setPage($request->getParameter('page', 1));
$this->pager->init();
$products=Doctrine\u Query::create()
->选择('t.name,p.price,p.id,pi.immagine,p.offer,p.special,t.description')
->from('Products p')
->leftJoin('p.ProductsImages pi')
->leftJoin('p.Translation t WITH t.lang=?',$this->getUser()->getAttribute('current_lang'))
->其中('p.active=?','1')
->其中('pi.ordine=?',0);
$term=explode(“”,$request['term']);
$ricerca='';
对于($i=0;$iandWhere('t.name如“%”.$term[$i].%.”或t.description如“%”.$term[$i].%%”);
}
$products->orderBy('t.name');
$this->pager=new-sfdoctrinepage('Products',sfConfig::get('app\u max\u page\u Products');
$this->pager->setQuery($products);
$this->pager->setPage($request->getParameter('page',1));
$this->pager->init();
$term=explode(“”,$request['term']);
$ricerca='';
对于($i=0;$iandWhere('t.name如“%”.$term[$i].%.”或t.description如“%”.$term[$i].%%”);
}
$products->orderBy('t.name');
$this->pager=new-sfdoctrinepage('Products',sfConfig::get('app\u max\u page\u Products');
$this->pager->setQuery($products);
$this->pager->setPage($request->getParameter('page',1));
$this->pager->init();

有什么解决方案吗?非常感谢。

构造查询时应使用参数:

$products->andWhere(
    't.name LIKE ? OR t.description LIKE ?',
    array('%'.$term[$i].'%', '%'.$term[$i].'%')
);

我怀疑点正在破坏字符串连接。您可能希望尝试使用其他方法生成查询字符串。