protected function _stringifyValues($generator)
{
$values = [];
$parts = $this->getValue();
if ($parts instanceof ExpressionInterface) {
return $parts->sql($generator);
}
foreach ($parts as $i => $value) {
if ($value instanceof ExpressionInterface) {
$values[] = $value->sql($generator);
continue;
}
$type = $this->_type;
$multiType = is_array($type);
$isMulti = $this->isMulti();
$type = $multiType ? $type : str_replace('[]', '', $type);
$type = $type ?: null;
if ($isMulti) {
$bound = [];
foreach ($value as $k => $val) {
$valType = $multiType ? $type[$k] : $type;
$bound[] = $this->_bindValue($generator, $val, $valType);
}
$values[] = sprintf('(%s)', implode(',', $bound));
continue;
}
$valType = $multiType && isset($type[$i]) ? $type[$i] : $type;
$values[] = $this->_bindValue($generator, $value, $valType);
}
return implode(', ', $values);
}