【发布时间】:2017-02-14 05:34:21
【问题描述】:
注意:Doctrine Query 中数组到字符串的转换
foreach($listLocations as $k=>$location){
$list[] = "'".$location['id']."'";
}
$storesList = implode(',', $list); // 打印字符串(23)"'191','195','215','265'"
$storesList = (string)$storesList;
我把它改成了字符串,但在查询中它仍然认为是数组
$sql="SELECT * from tbl_students WHERE s.store_id IN (".$storesList .")";
$conn = $this->getEntityManager()->getConnection();
$stmt = $conn->prepare($sql);
【问题讨论】:
标签: php arrays string symfony doctrine-orm