【发布时间】:2017-07-25 07:52:52
【问题描述】:
Doctrine2.5 与 PHP 5.6
我有很多东西要搜索,例如: 在用户表中,我想搜索拥有 字段名称中的名称“Reis”或“Shimidt”。用数组
$arraySearch = ['Reis', 'Shimidt'];
我想带例如以下条目,
- 约翰·雷斯·卡尔森,
- 玛丽·施密特·林肯,
- 比尔·雷斯·阿布多诺·盖茨。
我尝试过这样的事情:
$this->query->andWhere(" pb.name LIKE '%:name%' ");
$this->query->setParameter('name', $name, \Doctrine\DBAL\Types\Type::SIMPLE_ARRAY);
不行,我也这样试过,但是明显返回数组到字符串的转换:
$this->query->setParameter('name', '%'.$name.'%', \Doctrine\DBAL\Types\Type::SIMPLE_ARRAY);
任何想法如何解决这个问题,而无需编写凌乱的代码?
【问题讨论】:
标签: php laravel doctrine sql-like