protected function _setFieldValue($field, $value)
    {
        // ignore setting versioning fields
        if (static::isVersioned()) {
            if (array_key_exists($field, static::$versioningFields)) {
                return false;
            }
        }

        if (!static::fieldExists($field)) {
            return false;
        }
        $fieldOptions = static::$_classFields[get_called_class()][$field];

        // no overriding autoincrements
        if ($fieldOptions['autoincrement']) {
            return false;
        }

        // pre-process value
        $forceDirty = false;
        switch ($fieldOptions['type']) {
            case 'clob':
            case 'string':
            {
                $value = $this->_setStringValue($fieldOptions, $value);
                break;
            }

            case 'boolean':
            {
                $value = $this->_setBooleanValue($value);
                break;
            }

            case 'decimal':
            {
                $value = $this->_setDecimalValue($value);
                break;
            }

            case 'int':
            case 'uint':
            case 'integer':
            {
                $value = $this->_setIntegerValue($fieldOptions, $value);
                break;
            }

            case 'timestamp':
            {
                $value = $this->_setTimestampValue($value);
                break;
            }

            case 'date':
            {
                $value = $this->_setDateValue($value);
                break;
            }

            // these types are converted to strings from another PHP type on save
            case 'serialized':
            {
                $this->_convertedValues[$field] = $value;
                $value = $this->_setSerializedValue($value);
                break;
            }
            case 'enum':
            {
                $value = $this->_setEnumValue($fieldOptions, $value);
                break;
            }
            case 'set':
            case 'list':
            {
                $value = $this->_setListValue($fieldOptions, $value);
                $this->_convertedValues[$field] = $value;
                $forceDirty = true;
                break;
            }
        }

        if ($forceDirty || (empty($this->_record[$field]) && isset($value)) || ($this->_record[$field] !== $value)) {
            $columnName = static::_cn($field);
            if (isset($this->_record[$columnName])) {
                $this->_originalValues[$field] = $this->_record[$columnName];
            }
            $this->_record[$columnName] = $value;
            $this->_isDirty = true;

            // unset invalidated relationships
            if (!empty($fieldOptions['relationships']) && static::isRelational()) {
                foreach ($fieldOptions['relationships'] as $relationship => $isCached) {
                    if ($isCached) {
                        unset($this->_relatedObjects[$relationship]);
                    }
                }
            }
            return true;
        } else {
            return false;
        }
    }
protected function _setFieldValue($field, $value)
    {
        // ignore setting versioning fields
        if (static::isVersioned()) {
            if (array_key_exists($field, static::$versioningFields)) {
                return false;
            }
        }

        if (!static::fieldExists($field)) {
            return false;
        }
        $fieldOptions = static::$_classFields[get_called_class()][$field];

        // no overriding autoincrements
        if ($fieldOptions['autoincrement']) {
            return false;
        }

        // pre-process value
        $forceDirty = false;
        switch ($fieldOptions['type']) {
            case 'clob':
            case 'string':
            {
                $value = $this->_setStringValue($fieldOptions, $value);
                break;
            }

            case 'boolean':
            {
                $value = $this->_setBooleanValue($value);
                break;
            }

            case 'decimal':
            {
                $value = $this->_setDecimalValue($value);
                break;
            }

            case 'int':
            case 'uint':
            case 'integer':
            {
                $value = $this->_setIntegerValue($fieldOptions, $value);
                break;
            }

            case 'timestamp':
            {
                $value = $this->_setTimestampValue($value);
                break;
            }

            case 'date':
            {
                $value = $this->_setDateValue($value);
                break;
            }

            // these types are converted to strings from another PHP type on save
            case 'serialized':
            {
                $this->_convertedValues[$field] = $value;
                $value = $this->_setSerializedValue($value);
                break;
            }
            case 'enum':
            {
                $value = $this->_setEnumValue($fieldOptions, $value);
                break;
            }
            case 'set':
            case 'list':
            {
                $value = $this->_setListValue($fieldOptions, $value);
                $this->_convertedValues[$field] = $value;
                $forceDirty = true;
                break;
            }
        }

        if ($forceDirty || (empty($this->_record[$field]) && isset($value)) || ($this->_record[$field] !== $value)) {
            $columnName = static::_cn($field);
            if (isset($this->_record[$columnName])) {
                $this->_originalValues[$field] = $this->_record[$columnName];
            }
            $this->_record[$columnName] = $value;
            $this->_isDirty = true;

            // unset invalidated relationships
            if (!empty($fieldOptions['relationships']) && static::isRelational()) {
                foreach ($fieldOptions['relationships'] as $relationship => $isCached) {
                    if ($isCached) {
                        unset($this->_relatedObjects[$relationship]);
                    }
                }
            }
            return true;
        } else {
            return false;
        }
    }
protected function _setFieldValue ( $ field , $ value ) { // ignore setting versioning fields if ( static :: isVersioned ( ) ) { if ( array_key_exists ( $ field , static :: $ versioningFields ) ) { return false ; } } if ( ! static :: fieldExists ( $ field ) ) { return false ; } $ fieldOptions = static :: $ _classFields [ get_called_class ( ) ] [ $ field ] ; // no overriding autoincrements if ( $ fieldOptions [ 'autoincrement' ] ) { return false ; } // pre-process value $ forceDirty = false ; switch ( $ fieldOptions [ 'type' ] ) { case 'clob' : case 'string' : { $ value = $ this -> _setStringValue ( $ fieldOptions , $ value ) ; break ; } case 'boolean' : { $ value = $ this -> _setBooleanValue ( $ value ) ; break ; } case 'decimal' : { $ value = $ this -> _setDecimalValue ( $ value ) ; break ; } case 'int' : case 'uint' : case 'integer' : { $ value = $ this -> _setIntegerValue ( $ fieldOptions , $ value ) ; break ; } case 'timestamp' : { $ value = $ this -> _setTimestampValue ( $ value ) ; break ; } case 'date' : { $ value = $ this -> _setDateValue ( $ value ) ; break ; } // these types are converted to strings from another PHP type on save case 'serialized' : { $ this -> _convertedValues [ $ field ] = $ value ; $ value = $ this -> _setSerializedValue ( $ value ) ; break ; } case 'enum' : { $ value = $ this -> _setEnumValue ( $ fieldOptions , $ value ) ; break ; } case 'set' : case 'list' : { $ value = $ this -> _setListValue ( $ fieldOptions , $ value ) ; $ this -> _convertedValues [ $ field ] = $ value ; $ forceDirty = true ; break ; } } if ( $ forceDirty || ( empty ( $ this -> _record [ $ field ] ) && isset ( $ value ) ) || ( $ this -> _record [ $ field ] !== $ value ) ) { $ columnName = static :: _cn ( $ field ) ; if ( isset ( $ this -> _record [ $ columnName ] ) ) { $ this -> _originalValues [ $ field ] = $ this -> _record [ $ columnName ] ; } $ this -> _record [ $ columnName ] = $ value ; $ this -> _isDirty = true ; // unset invalidated relationships if ( ! empty ( $ fieldOptions [ 'relationships' ] ) && static :: isRelational ( ) ) { foreach ( $ fieldOptions [ 'relationships' ] as $ relationship => $ isCached ) { if ( $ isCached ) { unset ( $ this -> _relatedObjects [ $ relationship ] ) ; } } } return true ; } else { return false ; } }
Sets given field's value
@param string $field Name of field
@param mixed $value New value
@return mixed value
Sets given field s value