Method to reset class properties to the defaults set in the class
definition. It will ignore the primary key as well as any private class
properties.

@param bool $loadDefault

@return  static

@throws \Exception
@since   2.0
502570
public function reset($loadDefault = true)
    {
        $this->data = [];

        // Get the default values for the class from the table.
        foreach ((array) $this->getFields() as $k => $v) {
            $this->data[$k] = $loadDefault ? $v->Default : null;
        }

        return $this;
    }
567033
private function getDefault($reflectionProperty, $default)
    {
        $type = $this->getColumnAnnotation($reflectionProperty);
        if (null === $type) {
            return $default;
        }

        if (true === empty($default) && 'array' === $type) {
            return [];
        }

        return $default;
    }
231185
public function getDefault($load = false)
    {
        $store_id = $this->config->get('store', 1);

        if ($load) {
            return $this->get($store_id);
        }

        return (int) $store_id;
    }
594475
public function reset()
    {
        foreach (array_keys($this->_loaded) as $name) {
            $this->unload($name);
        }

        return $this;
    }
885117
public function setDefault($default)
    {
        if ($default !== null && !$this->getDataType()->doesAllowDefault()) {
            throw new LogicException(
                sprintf(
                    'Unable to set default value for the column. The data-type "%s" does not support a default.',
                    $this->getDataType()->getType()
                )
            );
        }

        if (is_array($default)) {
            foreach ($default as $k => $v) {
                $default[$k] = $this->getDataType()->cast($v);
            }
        } elseif ($default !== null) {
            if (!($this->getDataType() instanceof TimeTypeInterface)) {
                $default = $this->getDataType()->cast($default);
            }
        }

        $this->default = $default;
    }
718373
public function reset()
    {
        $this->data = [];

        // Get the default values for the class from the table.
        foreach ((array) $this->getFields() as $k => $v) {
            $this->data[$k] = null;
        }

        return $this;
    }
162578
public function setAttachmentDefaults($defaults)
    {
        if ($this->attachmentDefaults != ($defaults = (array) $defaults)) {
            $this->attachmentDefaults = $defaults;

            $this->setAttachments($this->attachments);
        }

        return $this;
    }
1362055
public function setDefault($fieldNames, $default)
    {
        if (is_array($fieldNames))
        {
            foreach ($fieldNames as $field_name)
            {
                $this->setDefault($field_name, $default);
            }
        }
        else
        {
            if (isset($this->m_fields[$fieldNames]))
            {
                $this->m_fields[$fieldNames]->setDefault($default);
            }
            else
            {
                $fields = print_r($this->m_fields, true);
                $err_msg = '[' . $fieldNames . '] field not found in table ' .
                           '[' . $this->m_name . '] when setting default ' . 
                           'fields. Fields: ' . $fields;

                throw new \Exception($err_msg);
            }
        }
    }
77720
public function setClasses($classes, $default = null)
    {
        if ($component = $this->getComponentByType(GridFieldAddNewMultiClass::class)) {
            $component->setClasses($classes, $default);
        }
        
        return $this;
    }
533056
public function reset($default = true)
    {
        foreach($this->_data as $state) {
            $this->set($state->name, $default ? $state->default : null);
        }

        return $this;
    }
961931
private function setDefaultsDisabled(bool $defaultsDisabled): self
    {
        $this->updatePropertyValue(
            DefaultsDisabledFieldInterface::PROP_DEFAULTS_DISABLED,
            $defaultsDisabled
        );

        return $this;
    }
823658
public function findControllerClassName($loadDefault = false)
    {
        $this->controllerClassName = '';
        do {
            $className = "\\App\\Controllers\\" . $this->routeParams->controllerName;
            if (class_exists($className)) {
                $this->controllerClassName = $className;
                break;
            }

            $className = "\\PG\\MSF\\Controllers\\" . $this->routeParams->controllerName;
            if (class_exists($className)) {
                $this->controllerClassName = $className;
                break;
            }

            $className = "\\App\\Console\\" . $this->routeParams->controllerName;
            if (class_exists($className)) {
                $this->controllerClassName = $className;
                break;
            }

            if ($loadDefault) {
                if ($this->defaultController) {
                    $className = "\\App\\Controllers\\" . $this->defaultController;
                    if (class_exists($className)) {
                        $this->controllerClassName = $className;
                        break;
                    }
                }
            }
        } while (0);

        if ($this->controllerClassName  == '') {
            return false;
        }

        return true;
    }
566715
public function reset()
    {
        $reflection = new \ReflectionClass(static::class);
        foreach ($reflection->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
            if (!$property->isStatic()) {
                $this->{$property->getName()} = null;
            }
        }
        return $this;
    }
372134
public function forceDefault($bForceDefault = null)
    {
        if (null === $bForceDefault) {
            return $this->getForceDefault();
        }

        return $this->setForceDefault($bForceDefault);
    }
49702
public function setDefault($default) {
        $entry_builder =
            new EntryBuilder();
        $entry_builder
            ->with($this->anything())
            ->will($default);

        $this->default_entry = $entry_builder->build();

        return $this;
    }
969796
public function resetDefault()
    {
        if ($record = $this->getSettingsRecord()) {
            $record->delete();
            unset(self::$instances[$this->recordCode]);
            Cache::forget($this->getCacheKey());
        }
    }
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)
                )
            );
        }
    }