Doctrine_Record::_set PHP Метод

_set() защищенный Метод

protected _set ( $fieldName, $value, $load = true )
    protected function _set($fieldName, $value, $load = true)
    {
        if (array_key_exists($fieldName, $this->_values)) {
            $this->_values[$fieldName] = $value;
        } else {
            if (array_key_exists($fieldName, $this->_data)) {
                $type = $this->_table->getTypeOf($fieldName);
                if ($value instanceof Doctrine_Record) {
                    $id = $value->getIncremented();
                    if ($id !== null && $type !== 'object') {
                        $value = $id;
                    }
                }
                if ($load) {
                    $old = $this->get($fieldName, $load);
                } else {
                    $old = $this->_data[$fieldName];
                }
                if ($this->_isValueModified($type, $old, $value)) {
                    if ($value === null) {
                        $value = $this->_table->getDefaultValueOf($fieldName);
                    }
                    $this->_data[$fieldName] = $value;
                    $this->_modified[] = $fieldName;
                    $this->_oldValues[$fieldName] = $old;
                    switch ($this->_state) {
                        case Doctrine_Record::STATE_CLEAN:
                        case Doctrine_Record::STATE_PROXY:
                            $this->_state = Doctrine_Record::STATE_DIRTY;
                            break;
                        case Doctrine_Record::STATE_TCLEAN:
                            $this->_state = Doctrine_Record::STATE_TDIRTY;
                            break;
                    }
                }
            } else {
                try {
                    $this->coreSetRelated($fieldName, $value);
                } catch (Doctrine_Table_Exception $e) {
                    $success = false;
                    foreach ($this->_table->getFilters() as $filter) {
                        try {
                            $value = $filter->filterSet($this, $fieldName, $value);
                            $success = true;
                        } catch (Doctrine_Exception $e) {
                        }
                    }
                    if ($success) {
                        return $value;
                    } else {
                        throw $e;
                    }
                }
            }
        }
        return $this;
    }