/** * setDefaultValues * sets the default values for records internal data * * @param boolean $overwrite whether or not to overwrite the already set values * @return boolean */ public function assignDefaultValues($data, $overwrite = false) { $table = $this->_record->getTable(); if (!$table->hasDefaultValues()) { return false; } $modified = array(); foreach ($data as $column => $value) { $default = $table->getDefaultValueOf($column); if ($default === null) { $default = self::$_null; } if ($value === self::$_null || $overwrite) { $this->_record->rawSet($column, $default); $modified[] = $column; $this->_record->state(Doctrine_Record::STATE_TDIRTY); } } $this->_record->setModified($modified); }