accept $id or $expandRowKey as model PK params
compatible with Karik grid detail request params
@return string
183156
public function actionDetail() {
        $request = Yii::$app->request;
        if (!is_null($id = $request->post('id', $request->post('expandRowKey')))) {
            $model = $this->retrieveModel($id);
            return $this->renderPartial('_detail', ['model' => $model]);
        } else {
            return '<div class="alert alert-danger">No data found</div>';
        }
    }
759519
public function generateUrlParams()
    {
        /* @var $class ActiveRecord */
        $class = $this->modelClass;
        $pks = $class::primaryKey();
        if (count($pks) === 1) {
            if (is_subclass_of($class, \yii\mongodb\ActiveRecord::class)) {
                return "'id' => (string)\$model->{$pks[0]}";
            }

            return "'id' => \$model->{$pks[0]}";
        }

        $params = [];
        foreach ($pks as $pk) {
            if (is_subclass_of($class, \yii\mongodb\ActiveRecord::class)) {
                $params[] = "'$pk' => (string)\$model->$pk";
            } else {
                $params[] = "'$pk' => \$model->$pk";
            }
        }

        return implode(', ', $params);
    }
797000
protected function _getKey()
    {
        $view = $this->getView();
        $key  = $view->getIdentifier().'-'.$view->getLayout();

        if ($this->getMixer() instanceof KControllerModellable)
        {
            $state = $this->getModel()->getState()->getValues();
            $key  .= ':'.md5(http_build_query($state, '', '&'));
        }

        return $key;
    }
1047392
private static function model()
    {
        $files = ['ORM_', 'CRUD', 'ORM', 'Collection', 'ModelArray'];
        $folder = static::$root.'MVC/Model'.'/';

        self::call($files, $folder);

        $files = ['ForeingKeyMethodException', 'ColumnNotEmptyException', 'ManyPrimaryKeysException', 'TableNotFoundException', 'ModelNotFoundException', 'PrimaryKeyNotFoundException'];
        $folder = static::$root.'MVC/Model/Exceptions'.'/';

        self::call($files, $folder);
    }
232082
public function getRequestQueryKey()
    {
        $uri = explode('?', $this->getEnv('REQUEST_URI'));

        array_shift($uri);
        parse_str(implode('?', $uri), $qrs);

        return array_keys($qrs);
    }
722809
public static function getRowMap($key=NULL)
    {
        if ($key) {
            return isset(self::$_keyRowMap[$key]) ? self::$_keyRowMap[$key] : NULL;
        } else {
            return self::$_keyRowMap;
        }
    }
1124174
public function getPkValue()
	{
		return isset($this->attributes[$this->getPrimaryKey()]) ? $this->attributes[$this->getPrimaryKey()] : null;
	}
1062144
public function formatRow()
    {
        // execute CompleteLister row formating
        parent::formatRow();

        if (empty($this->columns)) {
            throw $this->exception('No columns defined for grid');
        }

        foreach ($this->columns as $field => $column) {
            if ((is_array($this->current_row) || $this->current_row instanceof ArrayAccess)
                && array_key_exists($field, $this->current_row)
            ) {
                $this->current_row[$field.'_original'] = $this->current_row[$field];
            }

            // if model field has listData structure, then get value instead of key
            if ($this->model && $f = $this->model->hasElement($field)) {
                $v = $this->current_row[$field];

                if ($this->model instanceof \atk4\data\Model) {
                    /** @type \atk4\data\Field $f */
                    if (isset($f->enum) && $values = $f->enum) {
                        $this->current_row[$field] = isset($f->ui['valueList'][$v])
                            ? $f->ui['valueList'][$v]
                            : $values[$v];
                    }
                } else {
                    /** @type Field $f */
                    if ($f->type() !== 'boolean' && $values = $f->listData()) {
                        $this->current_row[$field] = $values[$v];
                    }
                }
            }

            // process formatters
            $this->executeFormatters($field, $column, 'format_');

            // setting cell parameters (tdparam)
            $this->applyTDParams($field);
        }
    }
11682
public function params($id = null, $array = false)
    {
        $config = Grav::instance()['config'];
        $sep = $config->get('system.param_sep');

        $params = null;
        if ($id === null) {
            if ($array) {
                return $this->params;
            }
            $output = [];
            foreach ($this->params as $key => $value) {
                $output[] = "{$key}{$sep}{$value}";
                $params = '/' . implode('/', $output);
            }
        } elseif (isset($this->params[$id])) {
            if ($array) {
                return $this->params[$id];
            }
            $params = "/{$id}{$sep}{$this->params[$id]}";
        }

        return $params;
    }
743344
private function getCustomParamsString()
    {
        $customParams = $this->getCustomParamsArray();
        foreach ($customParams as $key => $value) {
            $customParams[$key] = $key . '=' . $value;
        }
        return implode(':', $customParams);
    }
798773
function ( req ) {

    var pk = req.options.id || (req.options.where && req.options.where.id) || req.param('id');

    // TODO: make this smarter...
    // (e.g. look for actual primary key of model and look for it
    //  in the absence of `id`.)
    // See coercePK for reference (although be aware it is not currently in use)

    // exclude criteria on id field
    pk = _.isPlainObject(pk) ? undefined : pk;
    return pk;
  }
166597
public function getModelValue()
    {
        if (! is_callable($callback = $this->getCallback())) {
            throw new \Exception('Invalid custom column callback');
        }

        return call_user_func($callback, $this->getModel());
    }
536107
function ( key, parameters ) {
			var message = key.toLocaleString();
			// FIXME: This changes the state of the I18N object,
			// should probably not change the 'this.parser' but just
			// pass it to the parser.
			this.parser.language = $.i18n.languages[$.i18n().locale] || $.i18n.languages['default'];
			if( message === '' || message === '*' ) {
				
				if ( ( mode == "php" ) && ( message != '*' ) ) {

					$.post( "svc/backend/i18n/", { missing: key, lang : $.i18n().locale , layout : pageInfo["layout"] } );
				}
				
				message = key;
			}
			var result =  this.parser.parse( message, parameters );
			if ( result.substr(0,6) == 'UTF8: ') result = result.substr(6)
			return result;
		}
1214553
public static function findByPk($pk_value)
    {
        /* @var ActiveRecord $model */

        $model = new static();
        $pk_name = $model->getPkName();

        if (is_array($pk_name)) {
            $pk_condition = [];
            foreach ($pk_name as $pk) {
                $pk_condition[] = "T.{$pk} = :{$pk}";
            }
            $pk_condition = implode(' AND ', $pk_condition);
        } else {
            $pk_condition = "T.{$pk_name} = :{$pk_name}";
        }

        $params = [];
        if (is_array($pk_name)) {
            foreach ($pk_name as $pk) {
                $params[":{$pk}"] = $pk_value[$pk];
            }
        } else {
            $params[":{$pk_name}"] = $pk_value;
        }

        return self::find(['condition' => $pk_condition, 'params' => $params]);
    }
108827
public function generateUrlParams()
    {
        /* @var $class ActiveRecord */
        $class = $this->modelClass;
        $pks = $class::primaryKey();
        if (count($pks) === 1) {
            if (is_subclass_of($class, 'yii\mongodb\ActiveRecord')) {
                return "'id' => (string)\$model->{$pks[0]}";
            }

            return "'id' => \$model->{$pks[0]}";
        }

        $params = [];
        foreach ($pks as $pk) {
            if (is_subclass_of($class, 'yii\mongodb\ActiveRecord')) {
                $params[] = "'$pk' => (string)\$model->$pk";
            } else {
                $params[] = "'$pk' => \$model->$pk";
            }
        }

        return implode(', ', $params);
    }
803007
public function toModelAttribute($id)
	{
		if ($id === null) {
			$id = self::VALUE_NULL;
		}

		if (! array_key_exists($id,	$this->_map) ) {
			throw new Exception('Conversion from SimpleWorkflow failed : no key found for id = '.$id);
		}
		$value = $this->_map[$id];
		return ($value === self::VALUE_NULL ? null : $value);
	}
1078575
public function setPKValue(array $id)
    {
        if (count($id) !== count(static::$PKFieldName)) {
            throw new \InvalidArgumentException('Can`t set PK: passed values count not identical with primary key fields count');
        }

        if (count($id) === 1) {
            $this->{static::$PKFieldName[0]} = array_values($id)[0];

            return $this;
        }

        foreach ($id as $column => $value) {
            if ( ! self::isInPrimaryKey($column)) {
                throw new \InvalidArgumentException('Can`t set PK: Field `' . $column . '` is not a part of primary key.');
            }

            $this->$column = $value;
        }

        return $this;
    }