_typeMap !== null && $value instanceof IdentifierExpression ) { $type = $this->_typeMap->type($value->getIdentifier()); } elseif ($value instanceof TypedResultInterface) { $type = $value->getReturnType(); } return $type; } /** * Compiles a nullable value to SQL. * * @param \Cake\Database\ValueBinder $binder The value binder to use. * @param \Cake\Database\ExpressionInterface|object|scalar|null $value The value to compile. * @param string|null $type The value type. * @return string */ protected function compileNullableValue(ValueBinder $binder, $value, ?string $type = null): string { if ( $type !== null && !($value instanceof ExpressionInterface) ) { $value = $this->_castToExpression($value, $type); } if ($value === null) { $value = 'NULL'; } elseif ($value instanceof Query) { $value = sprintf('(%s)', $value->sql($binder)); } elseif ($value instanceof ExpressionInterface) { $value = $value->sql($binder); } else { $placeholder = $binder->placeholder('c'); $binder->bind($placeholder, $value, $type); $value = $placeholder; } return $value; } }