Try to determine the empty type from SQL type.

@param PropertyInterface $property The property to store the value into.
@param string            $sqlType  The SQL type.

@return void
963623
private function determineEmptyValueFromSql(PropertyInterface $property, $sqlType)
    {
        if ($property instanceof EmptyValueAwarePropertyInterface) {
            $property->setEmptyValue(Widget::getEmptyValueByFieldType($sqlType));
        }
    }
815456
private function doWrite(
        NodeInterface $node,
        PropertyInterface $property,
        $userId,
        $webspaceKey,
        $languageCode,
        $segmentKey,
        $isImport = false
    ) {
        if ($property->getIsBlock()) {
            /** @var BlockPropertyInterface $blockProperty */
            $blockProperty = $property;
            while (!($blockProperty instanceof BlockPropertyInterface)) {
                $blockProperty = $blockProperty->getProperty();
            }

            $data = $blockProperty->getValue();

            if (!$blockProperty->getIsMultiple()) {
                $data = [$data];
            }

            $data = array_filter($data);

            $len = count($data);

            // init properties
            $typeProperty = new Property('type', '', 'text_line');
            $lengthProperty = new Property('length', '', 'text_line');

            //save length
            $lengthProperty->setValue($len);
            $contentType = $this->contentTypeManager->get($lengthProperty->getContentTypeName());
            $contentType->write(
                $node,
                new BlockPropertyWrapper($lengthProperty, $property),
                $userId,
                $webspaceKey,
                $languageCode,
                $segmentKey
            );

            for ($i = 0; $i < $len; ++$i) {
                $blockPropertyType = $blockProperty->getProperties($i);

                // save type property
                $this->writeProperty(
                    $typeProperty,
                    $property,
                    $blockPropertyType->getName(),
                    $i,
                    $node,
                    $userId,
                    $webspaceKey,
                    $languageCode,
                    $segmentKey,
                    $isImport
                );

                foreach ($blockProperty->getProperties($i)->getChildProperties() as $subProperty) {
                    $this->writeProperty(
                        $subProperty,
                        $property,
                        $subProperty->getValue(),
                        $i,
                        $node,
                        $userId,
                        $webspaceKey,
                        $languageCode,
                        $segmentKey,
                        $isImport
                    );
                }
            }
        } else {
            throw new UnexpectedPropertyType($property, $this);
        }
    }
827880
public function setType(string $type) : void
    {
        if (empty($type)) {
            throw new InvalidArgumentException('Empty field type is not allowed: ' . $this->getName());
        }

        $this->_type = $this->_extractType($type);
    }
360700
public function checkProperty(&$property)
    {
        if (is_string($property)) {
            $property = Placeholder::replaceStringsAndComments($property);
            $property = Placeholder::removeCommentPlaceholders($property, true);
            $property = Placeholder::replaceStringPlaceholders($property, true);

            return true;
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($property). "' for argument 'property' given."
            );
        }
    }
1198667
public function beforePropertyModelSave(Property &$property, $insert)
    {
        if ($property->canTranslate()) {
            $property->data_type = Property::DATA_TYPE_INVARIANT_STRING;
        }
        return parent::beforePropertyModelSave($property, $insert);
    }
972506
public void in(Object key, Object value, Integer type) throws SQLException {
        if (key instanceof Integer) {
            if (type == null) {
                base.setObject((Integer) key, value);
            } else {
                base.setObject((Integer) key, value, type);
            }
        } else {
            if (type == null) {
                base.setObject((String) key, value);
            } else {
                base.setObject((String) key, value, type);
            }
        }
    }
349774
private function loadPropertyType(\ReflectionProperty $property)
    {
        if ($this->extractor === null) {
            return;
        }

        $types = $this->extractor->getTypes($property->class, $property->name);

        if (empty($types)) {
            return;
        }

        $extractedType = current($types);
        $type = $extractedType->getBuiltinType();

        if ($type === 'object') {
            $type = $extractedType->getClassName();
        }

        return $type;
    }
276361
public function isDirty($property = null)
    {
        if ($property === null) {
            return !empty($this->_dirty);
        }

        return isset($this->_dirty[$property]);
    }
834218
public function validateProperty(string $property, $allowed): bool
    {
        if (is_string($allowed)) {
            $allowed = explode('|', $allowed);
        }

        if (!is_array($allowed)) {
            throw new InvalidTypeException('$allowed must be a string or array');
        }

        $valid = false;
        $optional = in_array('optional', $allowed);

        if ($optional && (!isset($this->{$property}) || $this->{$property} === null)) {
            return true;
        }

        foreach ($allowed as $index => $type) {
            if ($type === 'optional') {
                continue;
            }

            if ($valid = $this->validatePropertyType($property, $type)) {
                break;
            }
        }

        if (!$valid) {
            $this->throwInvalidTypeException($property, $allowed, $optional);
        }

        return true;
    }
950769
public function property(string $propertyName): PropertyColumnDefiner
    {
        $this->verifyProperty(__METHOD__, $propertyName);

        return new PropertyColumnDefiner($this, $propertyName, function (
            Column $column,
            callable $phpToDbPropertyConverter = null,
            callable $dbToPhpPropertyConverter = null,
            bool $ignoreNullabilityMismatch = false
        ) use ($propertyName) {
            $this->propertyColumnMap[$propertyName] = $column->getName();
            $this->addColumn($column);
            $this->mappedProperties[$propertyName] = true;

            $propertyType = $this->class->getProperty($propertyName)->getType();
            $columnType   = $column->getType()->getPhpType();

            if ($ignoreNullabilityMismatch) {
                $propertyType = $propertyType->nonNullable();
                $columnType   = $columnType->nonNullable();
            }

            if ($phpToDbPropertyConverter && $dbToPhpPropertyConverter) {
                $this->phpToDbPropertyConverterMap[$propertyName] = $phpToDbPropertyConverter;
                $this->dbToPhpPropertyConverterMap[$propertyName] = $dbToPhpPropertyConverter;
            } elseif (!$propertyType->equals($columnType)) {
                throw IncompatiblePropertyMappingException::format(
                    'Invalid property to column mapping: cannot bind %s to column \'%s\' as the types are incompatible, '
                    . 'property type %s must match the column type %s',
                    $this->class->getClassName() . '::$' . $propertyName, $column->getName(),
                    $propertyType->asTypeString(), $columnType->asTypeString()
                );
            }
        });
    }
653612
public void setPropertyDefaultType (Class type, String propertyName, Class defaultType) {
		if (type == null) throw new IllegalArgumentException("type cannot be null.");
		if (propertyName == null) throw new IllegalArgumentException("propertyName cannot be null.");
		if (defaultType == null) throw new IllegalArgumentException("defaultType cannot be null.");
		Property property = Beans.getProperty(type, propertyName, beanProperties, privateFields, this);
		if (property == null)
			throw new IllegalArgumentException("The class " + type.getName() + " does not have a property named: " + propertyName);
		propertyToDefaultType.put(property, defaultType);
	}
1184425
public function setType($type = 'string')
    {
        if (!\in_array($type, $this->validTypes, true)) {
            throw new InvalidQueryParameterTypeException($type, $this->validTypes);
        }

        $this->type = $type;
    }
1117867
public function addInheritedProperty(Property $property)
    {
        $inheritedProperty = clone $property;
        $declaringClass    = $property->getDeclaringClass();

        if ($inheritedProperty instanceof FieldMetadata) {
            if (! $declaringClass->isMappedSuperclass) {
                $inheritedProperty->setTableName($property->getTableName());
            }

            $this->fieldNames[$property->getColumnName()] = $property->getName();
        } elseif ($inheritedProperty instanceof AssociationMetadata) {
            if ($declaringClass->isMappedSuperclass) {
                $inheritedProperty->setSourceEntity($this->className);
            }

            // Need to add inherited fieldNames
            if ($inheritedProperty instanceof ToOneAssociationMetadata && $inheritedProperty->isOwningSide()) {
                foreach ($inheritedProperty->getJoinColumns() as $joinColumn) {
                    /** @var JoinColumnMetadata $joinColumn */
                    $this->fieldNames[$joinColumn->getColumnName()] = $property->getName();
                }
            }
        }

        if (isset($this->declaredProperties[$property->getName()])) {
            throw MappingException::duplicateProperty($this->className, $this->getProperty($property->getName()));
        }

        $this->declaredProperties[$property->getName()] = $inheritedProperty;

        if ($inheritedProperty instanceof VersionFieldMetadata) {
            $this->versionProperty = $inheritedProperty;
        }
    }
863646
public void setNull(String parameterName, int sqlType) throws SQLException {
		checkClosed();
		try {
			this.internalCallableStatement.setNull(parameterName, sqlType);
			if (this.logStatementsEnabled){
				this.logParams.put(parameterName, PoolUtil.safePrint("[SQL NULL type ", sqlType, "]"));
			}
		} catch (SQLException e) {
			throw this.connectionHandle.markPossiblyBroken(e);
			
		}
	}
107421
private function throwUnlessCorrectType($property, $value)
    {
        $typeUsedToBe = $this->getTypeUsedToBe($property);

        if ($typeUsedToBe !== "null") {
            $typeWantsToBe = $this->getTypeWantsToBe($value);

            if ($typeUsedToBe !== $typeWantsToBe) {
                throw new Exception();
            }
        }
    }
350036
protected function validateAndCompleteFieldMapping(FieldMetadata $property)
    {
        $fieldName  = $property->getName();
        $columnName = $property->getColumnName();

        if (empty($columnName)) {
            $columnName = $this->namingStrategy->propertyToColumnName($fieldName, $this->className);

            $property->setColumnName($columnName);
        }

        if (! $this->isMappedSuperclass) {
            $property->setTableName($this->getTableName());
        }

        // Check for already declared column
        if (isset($this->fieldNames[$columnName]) ||
            ($this->discriminatorColumn !== null && $this->discriminatorColumn->getColumnName() === $columnName)) {
            throw MappingException::duplicateColumnName($this->className, $columnName);
        }

        // Complete id mapping
        if ($property->isPrimaryKey()) {
            if ($this->versionProperty !== null && $this->versionProperty->getName() === $fieldName) {
                throw MappingException::cannotVersionIdField($this->className, $fieldName);
            }

            if ($property->getType()->canRequireSQLConversion()) {
                throw MappingException::sqlConversionNotAllowedForPrimaryKeyProperties($this->className, $property);
            }

            if (! in_array($fieldName, $this->identifier, true)) {
                $this->identifier[] = $fieldName;
            }
        }

        $this->fieldNames[$columnName] = $fieldName;
    }
858308
public void setObjectForStatement(PreparedStatement ps, int index,
                                      Object value, int sqlType) throws SQLException
    {
        if (sqlType == Types.TINYINT)
        {
            ps.setByte(index, ((Byte) value).byteValue());
        }
        else
        {
            super.setObjectForStatement(ps, index, value, sqlType);
        }
    }