如何删除 IN 条件 cakephp 中的单引号

how to remove single quotes inside IN condition cakephp

我试图在 cakephp 3 中的 IN 条件内传递逗号分隔值,但它获取的值在方括号 ('12,18') 内带有单引号。

请建议我如何删除它。

预期输出 (12,18)

下面是我的代码

public function checkPermission(){
        $userId = $this->request->getSession()->read('Auth.User.id');
        $arodta = TableRegistry::get('Aros');
        $Arosdata = $arodta->find()->where(['foreign_key' => $userId])->first()->toArray();
        if(!empty($Arosdata)){
            $aroId = $Arosdata['parent_id'];
            $aroAcodata = TableRegistry::get('ArosAcos');
            $arocodata = $aroAcodata->find()->where(['aro_id =' => $aroId]);   
            if(!empty($arocodata)) {
                foreach ($arocodata as $data){ 
                    $acoId[] = $data['aco_id'];
                }
                if(!empty($acoId)){
                    $acoData = implode(',',$acoId);
                    $acosName = TableRegistry::get('Acos');
                    $arac = $acosName->find()->where(['id IN' => $acoData]);
                    sql($arac);exit;                                           
                }
            }
        }                         
    }

我的数组数据

$acoId[] = 

    Array
    (
        [0] => 12
        [1] => 18
    )

我得到的输出类似于

SELECT 
  Acos.id AS `Acos__id`, 
  Acos.parent_id AS `Acos__parent_id`, 
  Acos.model AS `Acos__model`, 
  Acos.foreign_key AS `Acos__foreign_key`, 
  Acos.alias AS `Acos__alias`, 
  Acos.lft AS `Acos__lft`, 
  Acos.rght AS `Acos__rght` 
FROM 
  acos Acos 
WHERE 
  id in ('12,18')

在 Cakephp 中,您可以直接为 IN 子句传递数组,而不是用逗号将其内爆。在查询中使用 $acoId 数组:

$arac = $acosName->find()->where(['id IN' => $acoId]);