Returns the raw Model record that stores the settings.
@return Model
13416
public function getSettingsRecord()
    {
        $record = $this->model
            ->where('item', $this->recordCode)
            ->remember(1440, $this->getCacheKey())
            ->first();

        return $record ?: null;
    }
205174
public function settings()
    {
        if (is_null($this->settingRequests)) {
            $this->settingRequests = new SettingRequests($this->client);
        }

        return $this->settingRequests;
    }
1350919
public function getModel()
    {
        if ($this->_model === null) {
            $this->_model = Nav::findOne($this->navId);
            
            if (empty($this->_model)) {
                throw new Exception('The model active record could not be found for the corresponding nav item. Maybe you have inconsistent Database data.');
            }
        }
        
        return $this->_model;
    }
448783
public function getConfiguration()
    {
        if (!$this->_configuration) {

            //If model is using
            if ($this->modelClass) {

                $this->_configuration = $this->_keyStorage->get($this->getKey()) ?: [];
                $modelClass = $this->modelClass;
                if (!$this->_configuration || !($this->_configuration instanceof $modelClass)) {
                    //Initialize new model. Default values must be set in model (init method)
                    $this->_configuration = Yii::createObject($modelClass, $this->modelConfig);
                }

                //Default values from 'attributes'
                if (is_array($this->attributes)) {
                    foreach ($this->attributes as $key => $default) {
                        if ($this->_configuration->{$key} === null) {
                            $this->_configuration->{$key} = $default;
                        }
                    }
                }

            } else {

                //Array configuration
                $dbConfig = $this->_keyStorage->get($this->getKey()) ?: [];

                if (is_array($this->attributes)) {
                    //Needs to filter
                    $config = [];
                    foreach ($this->attributes as $key => $default) {
                        $config[$key] = (isset($dbConfig[$key]) && $dbConfig[$key] !== null) ? $dbConfig[$key] : $default;
                    }
                    $this->_configuration = $config;
                } else {
                    $this->_configuration = $dbConfig;
                }

            }
        }
        return $this->_configuration;
    }
1361079
public function getModels()
    {
        // First, we will simply get the raw results from the query builders which we
        // can use to populate an array with Eloquent models. We will pass columns
        // that should be selected as well, which are typically just everything.
        $results = $this->query->get();

        $connection = $this->model->getConnectionName();

        $models = [];

        // Once we have the results, we can spin through them and instantiate a fresh
        // model instance for each records we retrieved from the database. We will
        // also set the proper connection name for the model after we create it.
        foreach ($results as $result) {
            $models[] = $model = $this->model->newFromBuilder($result);

            $model->setConnection($connection);
        }

        return $models;
    }
743281
public function getModel()
    {
        $collection = $this->getCollection();

        /** @var EntityDataModel $model */
        $model = $collection->getModel();
        $model->setEntityManager($this);

        return $model;
    }
175002
public function fresh()
    {
        $model = $this->query->newInstance()->findByDn($this->getDn());

        return $model instanceof Model ? $model : null;
    }
853553
public function map()
    {
        $column = array();
        foreach ($this as $record) {
            $key = reset($record);
            $val = next($record);
            $column[$key] = $val;
        }
        return $column;
    }
81775
public function get_setting() {
        global $CFG;

        $config = $this->config_read($this->name);
        if (is_null($config)) {
            return null;
        }

        return $this->prepare_form_data($config);
    }
441183
public function getDataStorageModel()
    {
        if (! $this->_dataModel instanceof FieldDataModel) {
            $this->_dataModel = $this->tracker->createTrackClass('Model\\FieldDataModel');
        }

        return $this->_dataModel;
    }
516627
public function settingsGetAll()
    {
        global $CFG;
        $name = $this->ENTITY_NAME;
        $retval = $this->ltiParameter($name."_settings", false);

        // Null means in the session - false means not in the session
        if ( $retval === null || ( is_string($retval) && strlen($retval) < 1 ) ) {
            $retval = array();
        } else if ( strlen($retval) > 0 ) {
            try {
                $retval = json_decode($retval, true);
            } catch(Exception $e) {
                $retval = array();
            }
        }
        // echo("Session $name: "); var_dump($retval);
        if ( is_array($retval) ) return $retval;

        $row = $this->launch->pdox->rowDie("SELECT settings FROM {$CFG->dbprefix}{$this->TABLE_NAME}
            WHERE {$name}_id = :ID",
            array(":ID" => $this->id));

        if ( $row === false ) return array();
        $json = $row['settings'];
        if ( $json === null ) return array();
        try {
            $retval = json_decode($json, true);
        } catch(Exception $e) {
            $retval = array();
        }

        // Put in session for quicker retrieval
        $this->ltiParameterUpdate($name."_settings", json_encode($retval));
        // echo("<hr>From DB\n");var_dump($retval);
        return $retval;
    }
652927
protected function getRecord()
    {
        $id = (int) $this->request->param('ID');
        if (!$id) {
            $id = (int) $this->request->requestVar('ID');
        }
        if ($id) {
            $type = $this->stat('model_class');
            $action = $this->request->param('Action');
            if ($action == 'dashlet' || $action == 'widget') {
                $type = 'Dashlet';
            }
            $item = $this->dataService->byId($type, $id);
            if ($item instanceof DashboardPage) {
                $item->setController($this);
            }

            return $item;
        }
    }
1056944
public function getManagedModels()
    {
        $models = $this->getVersionedModels();

        // Normalize models to have their model class in array key and all names as the value are uppercased
        foreach ($models as $k => $v) {
            $archivedModels[$v] = array('title' => ucfirst(singleton($v)->i18n_plural_name()));
            unset($archivedModels[$k]);
        }

        return $archivedModels;
    }
846694
protected function _model()
    {
        if ($this->_model !== null) {
            return $this->_model;
        }

        $model = 'I18nMessages';
        if (!empty($this->params['model'])) {
            $model = $this->params['model'];
        }

        return $this->_model = TableRegistry::get($model);
    }
155349
public function recordEditForm()
    {
        //clone current request : used to figure out what record we are asking
        $request = clone $this->request;
        $recordInfo = $request->shift();

        //shift request till we find the requested field
        while ($recordInfo) {
            if ($unescapedRecordInfo = $this->unEscapeFieldName($recordInfo)) {
                $id = $unescapedRecordInfo['id'];
                $fieldName = $unescapedRecordInfo['name'];

                $action = $request->shift();
                break;
            } else {
                $recordInfo = $request->shift();
            }
        }

        //generate a form with only that requested record's fields
        if ($id) {
            $modelClass = $this->gridField->getModelClass();
            $record = DataObject::get_by_id($modelClass, $id);

            $cmsFields = $record->getCMSFields();
            $recordEditingFields = $this->getRecordEditingFields($record);

            return Form::create(
                $this->gridField,
                'recordEditForm',
                FieldList::create($recordEditingFields),
                FieldList::create()
            );
        }
    }
581608
final public function to_record() {
        $data = new stdClass();
        $properties = static::properties_definition();
        foreach ($properties as $property => $definition) {
            $data->$property = $this->raw_get($property);
        }
        return $data;
    }
883558
public function save()
    {
        $di = DI::getDefault();

        $database = $di->getService( "database" );

        /**
         * Decide if we should update or insert
         * (if we know the record exists in the database...)
         */
        if ( $this->_exists_in_db )
        {
            /**
             * Retrieve a query from the query builder
             */
            $query = $database->buildQuery( $this->_table_name, "update", array("columns" => $this->_columns) );
            
            /**
             * Create an array with the model attributes (binding parameters)
             */
            $attributes = $this->getAttributes();
            
            /**
             * Add "snap_" prefix to the snapshot in order to not get index conflict when we merge attributes and snapshot
             */
            $snapshot = array();
            
            foreach ( $this->_snapshot as $key => $value )
            {
                $snapshot["snap_" . $key] = $value;
            }
            
            /**
             * Merge our binding parameters.
             * Bind the parameters to the query and return the result.
             */
            return $query->execute( array_merge($attributes, $snapshot) );
        }
        else
        {
            /**
             * Retrieve a query from the query builder
             */
            $query = $database->buildQuery( $this->_table_name, "insert", array("columns" => $this->_columns) );
            
            /**
             * Create an array with the model attributes (binding parameters)
             */
            $attributes = $this->getAttributes();
            
            /**
             * Bind the parameters and return the result
             */
            return $query->execute( $attributes );
        }
    }