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()
                );
            }
        });
    }
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()
                );
            }
        });
    }
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 ( ) ) ; } } ) ; }
Defines a mapping between the class property to a the table column

@param string $propertyName

@return PropertyColumnDefiner
@throws InvalidArgumentException
Defines a mapping between the class property to a the table column