I am not sure If I missed something, but if I use
the following condition like mentioned in the documentation, I get no parenthesis around the in/where in part of the SQL query, which leads to an exception.
It’s a postgresql database.
concrete code:
This does not work
$updateWorkflows = models\UpdateWorkflow::find()
->where([
'and',
'status='.Workflow::WORKFLOW_STATUS_TODO,
'type='.Workflow::WORKFLOW_TYPE_UPDATE,
['in ','library', ['lib1','lib2']]
])
->orderBy('date asc')->all();
this does not work either
$updateWorkflows = models\UpdateWorkflow::find()
->where([
'status'=>Workflow::WORKFLOW_STATUS_TODO,
'type'=>Workflow::WORKFLOW_TYPE_UPDATE,
])
->andWhere(['not in ','library', $blockedLibs])
->orderBy('date asc')->all();
Edit:
Not sure about the parenthesis. (I used getRawSQL, which is not reliable as the docs states)
I get an "Undefined Offset" Message:
Exception ‘yii\db\Exception’ with message 'Undefined offset: 1
Failed to prepare SQL: SELECT * FROM “workflow” WHERE (status=103) AND (type=0) AND (“library” NOT IN :qp0) ORDER BY “date”’