LoadDefaults is called during construction if this object is not instantiated with
a DB row.  The default values as specified in the fieldmap are loaded

@access     public
182666
public function LoadDefaults()
	{
		$fms = $this->_phreezer->GetFieldMaps(get_class($this));

		foreach ($fms as $fm)
		{
			$prop = $fm->PropertyName;
			$this->$prop = $fm->DefaultValue;
		}
	}
896232
protected function _setDefault()
    {
        if ($this->_default === null) {
            $this->_table->alter(
                sprintf('ALTER COLUMN %s DROP DEFAULT', $this->_database->prepareIdentifier($this->_name))
            );
        } else {
            $this->_table->alter(
                sprintf(
                    'ALTER COLUMN %s SET DEFAULT %s',
                    $this->_database->prepareIdentifier($this->_name),
                    $this->_database->prepareValue($this->_default, $this->_datatype)
                )
            );
        }
    }
205592
private function load()
    {
        if ($this->loaded) {
            return;
        }

        $models = (array) $this->query->find();

        $preferred = array();
        if ($this->preferredQuery instanceof \ModelCriteria) {
            $preferred = (array) $this->preferredQuery->find();
        }

        try {
            // The second parameter $labels is ignored by ObjectChoiceList
            parent::initialize($models, array(), $preferred);

            $this->loaded = true;
        } catch (StringCastException $e) {
            throw new StringCastException(str_replace('argument $labelPath', 'option "property"', $e->getMessage()), null, $e);
        }
    }
197159
protected function load()
    {
        if (!$this->isConfigurationLoaded) {
            $this->values = $this->getDefaults();
            $values = $this->getConfigStore()->load();
            if (is_array($values)) {
                $this->values = array_merge($this->getDefaults(), $values);
            }
            $this->values = $this->castValues($this->values);
            $this->isConfigurationLoaded = true;
        }
    }
959110
public function loadDefaults()
    {
        // Obtain Default and Current Site Config:
        
        $default = SiteConfig::create();
        $current = SiteConfig::current_site_config();
        
        // Check App Title:
        
        if (!is_null($this->config()->title)) {
            
            // Update Site Title:
            
            if ($current->Title == $default->Title) {
                $current->Title = $this->config()->title;
            }
            
        }
        
        // Check App Tagline:
        
        if (!is_null($this->config()->tagline)) {
            
            // Update Site Tagline:
            
            if ($current->Tagline == $default->Tagline) {
                $current->Tagline = $this->config()->tagline;
            }
            
        }
        
        // Save Site Config Changes:
        
        if ($current->isChanged('Title') || $current->isChanged('Tagline')) {
            
            if ($current->isChanged('Title')) {
                
                DB::alteration_message(
                    sprintf(
                        'Updating App Title to "%s"',
                        $current->Title
                    ),
                    'changed'
                );
                
            }
            
            if ($current->isChanged('Tagline')) {
                
                DB::alteration_message(
                    sprintf(
                        'Updating App Tagline to "%s"',
                        $current->Tagline
                    ),
                    'changed'
                );
                
            }
            
            $current->write();
            
        }
        
    }
189505
public function populateDefaults()
    {
        parent::populateDefaults();

        if (!isset($this->Date) || $this->Date === null) {
            $this->Date = DBDatetime::now()->Format('y-MM-dd 09:00:00');
        }
    }
1309330
public function initMapper() {
		switch ($this->dbsType) {
			case 'jig':
				$this->mapper = new Jig\Mapper($this->db, $this->table);
				break;
			case 'sql':
				// ensure to load full table schema, so we can work with it at runtime
				$this->mapper = new SQL\Mapper($this->db, $this->table, null,
					($this->fluid)?0:$this->ttl);
				$this->applyWhitelist();
				break;
			case 'mongo':
				$this->mapper = new Mongo\Mapper($this->db, $this->table);
				break;
			default:
				trigger_error(sprintf(self::E_UNKNOWN_DB_ENGINE,$this->dbsType),E_USER_ERROR);
		}
		$this->queryParser = CortexQueryParser::instance();
		$this->reset();
		$this->clearFilter();
		$f3 = \Base::instance();
		$this->smartLoading = $f3->exists('CORTEX.smartLoading') ?
			$f3->get('CORTEX.smartLoading') : TRUE;
		$this->standardiseID = $f3->exists('CORTEX.standardiseID') ?
			$f3->get('CORTEX.standardiseID') : TRUE;
		if(!empty($this->fieldConf))
			foreach($this->fieldConf as &$conf) {
				$conf=static::resolveRelationConf($conf,$this->primary);
				unset($conf);
			}
	}
374496
private function setDefaultValueInternal()
    {
        $defaultValue = $this->getDefaultValue();
        if ($defaultValue == 'now') {
            $defaultValue = new DateTimeObject('now');
        }
        $this->setValue($defaultValue);
    }
1333271
public function setDefault($default)
    {
        // Since SQL types cannot be completely mapped to PHP types, a loose
        // comparision is required, but changes to/from NULL must be taken into
        // account.
        if (
            $this->_default === null and $default !== null or
            $this->_default !== null and $default === null or
            $this->_default != $default
        ) {
            $this->_default = $default;
            if ($this->_table) {
                $this->_setDefault();
            }
        }
    }
644201
public function initDefaultProperties()
    {
        if (!empty($this->schema->properties)) {
            foreach ($this->schema->properties as $property_name => $property) {
                if ($this->setPropertyDefaultValue($property)) {
                    $this->property_values->$property_name = $this->getFactory()->create($property, $this->schema_path);
                }
            }
        }
    }
24768
private function setToDefault():void
    {
        $this->session = null;
        $this->id = null;
        $this->name = null;
    }
1249674
protected function initializeDefaultValues()
    {
        $defaults = [];

        $filters = $this->getFilterInformation();

        foreach (array_keys($filters) as $key) {
            $defaults[ $key ] = null;
        }

        $this->defaults = $defaults;

        return $this;
    }
1288275
public function initializeObject() {
		$databaseFilePath = $this->storageFolder . md5($this->getIndexName()) . '.db';
		$createDatabaseTables = FALSE;

		if (!is_file($databaseFilePath)) {
			if (!is_dir($this->storageFolder)) {
				mkdir($this->storageFolder, 0777, TRUE);
			}
			$createDatabaseTables = TRUE;
		}
		$this->connection = new \SQLite3($databaseFilePath);

		if ($createDatabaseTables) {
			$this->createIndexTables();
		} else {
			$this->loadAvailablePropertyFields();
		}
	}
161264
public function setDefaultValue($value = null)
    {
        if (! $this->value) {
            if ($value = $value ?: config("fields.values.{$this->key}")) {
                foreach ((array) $value as $locale => $translation) {
                    $locale = is_string($locale) ? $locale : $this->getDefaultLocale();
                    $this->setTranslation('value', $translation, $locale);
                    $this->addTranslated($locale);
                }
            }
        }
    }
1313558
private function initialize()
    {
        $this->pdo->exec(
            'CREATE TABLE IF NOT EXISTS `'.$this->table.'` '
            .'(id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY, channel VARCHAR(255), level INTEGER, message LONGTEXT, time INTEGER UNSIGNED, INDEX(channel) USING HASH, INDEX(level) USING HASH, INDEX(time) USING BTREE)'
        );

        //Read out actual columns
        $actualFields = array();
        $rs = $this->pdo->query('SELECT * FROM `'.$this->table.'` LIMIT 0');
        for ($i = 0; $i < $rs->columnCount(); $i++) {
            $col = $rs->getColumnMeta($i);
            $actualFields[] = $col['name'];
        }

        //Calculate changed entries
        $removedColumns = array_diff(
            $actualFields,
            $this->additionalFields,
            $this->defaultfields
        );
        $addedColumns = array_diff($this->additionalFields, $actualFields);

        //Remove columns
        if (!empty($removedColumns)) {
            foreach ($removedColumns as $c) {
                $this->pdo->exec('ALTER TABLE `'.$this->table.'` DROP `'.$c.'`;');
            }
        }

        //Add columns
        if (!empty($addedColumns)) {
            foreach ($addedColumns as $c) {
                $this->pdo->exec('ALTER TABLE `'.$this->table.'` add `'.$c.'` TEXT NULL DEFAULT NULL;');
            }
        }

        // merge default and additional field to one array
        $this->defaultfields = array_merge($this->defaultfields, $this->additionalFields);

        $this->initialized = true;
    }
61767
protected function setDefaultParams()
    {
        foreach ($this->allowedParams as $param => $options) {
            $this->params[$param] = null;
            if (! empty($options['arguments'])) {
                $this->params[$param] = array();
                foreach ($options['arguments'] as $arg => $opts) {
                    if (! empty($opts['default'])) {
                        $cast = ! empty($opts['cast']) ? $opts['cast'] : 'string';
                        $this->params[$param][$arg] = $this->castValue($cast, $opts['default']);
                    }
                }
            } elseif (! empty($options['default'])) {
                $cast = ! empty($options['cast']) ? $options['cast'] : 'string';
                $this->params[$param] = $this->castValue($cast, $options['default']);
            }
        }
    }
1287736
protected function SetDefaultFieldVars()
    {
        if ($this->global->UserDataExists(TdbShopArticleReview::INPUT_BASE_NAME)) {
            $aPostUserData = $this->global->GetuserData(TdbShopArticleReview::INPUT_BASE_NAME);
        }
        $aDefaultFieldDataList = array('comment' => '', 'author_email' => '', 'author_name' => '', 'title' => '', 'send_comment_notification' => '0', 'rating' => 1);
        if (isset($aPostUserData) && is_array($aPostUserData)) {
            foreach ($aDefaultFieldDataList as $sDefaultFieldDataKey => $aDefaultFieldDataValue) {
                if (!array_key_exists($sDefaultFieldDataKey, $aPostUserData)) {
                    $aPostUserData[$sDefaultFieldDataKey] = $aDefaultFieldDataValue;
                }
            }
            $aDefaultFieldDataList = $aPostUserData;
        }

        return $aDefaultFieldDataList;
    }