QueryBuilder and sub-conditions
$qb->andWhere( $qb->expr()->andx( $qb->expr()->andx( $qb->expr()->eq('status', 0), $qb->expr()->andx( $qb->expr()->notLike('model', '308'), $qb->expr()->notLike('model', '408') ) ), $qb->expr()->andx( $qb->expr()->eq('status', 1), $qb->expr()->andx( $qb->expr()->notLike('model', 'A1'), $qb->expr()->notLike('model', 'A2') ) ) ));
You can go wild with nesting expressions as long as you read the docs
Let me know if you need help :)
Thanks to Matteo & pcm
$qb->andWhere( $qb->expr()->orX( $qb->expr()->andX($qb->expr()->eq("status", 0), $qb->expr()->notIn("model", $listNewModel)), $qb->expr()->andX($qb->expr()->eq("status", 1), $qb->expr()->notIn("model", $listUsedModel)); ));