/**
* Appends a NOT IN condition to the current conditions
*
*<code>
* $builder->notInWhere('id', [1, 2, 3]);
*</code>
*
* @param string $expr
* @param array|\ManaPHP\Mvc\Model\QueryBuilderInterface $values
*
* @return static
*/
public function notInWhere($expr, $values)
{
if ($values instanceof $this) {
$this->andWhere($expr . ' NOT IN (' . $values->getSql() . ')');
$this->_bind = array_merge($this->_bind, $values->getBind());
} else {
if (count($values) === 0) {
return $this;
}
$bind = [];
$bindKeys = [];
/** @noinspection ForeachSourceInspection */
foreach ($values as $k => $value) {
$key = '_not_in_' . self::$_hiddenParamNumber . '_' . $k;
$bindKeys[] = ':' . $key;
$bind[$key] = $value;
}
self::$_hiddenParamNumber++;
$this->andWhere($expr . ' NOT IN (' . implode(', ', $bindKeys) . ')', $bind);
}
return $this;
}