Beispiel #1
0
    /**
     * Overridden to add additional model states to the existing model
     *
     * @see KControllerResource::getModel()
     */
    public function getModel()
    {
        if(!$this->_model instanceof KModelAbstract)
        {
            //Make sure we have a model identifier
            if (!($this->_model instanceof KServiceIdentifier)) {
                $this->setModel($this->_model);
            }

            $model = $this->getService($this->_model);
            $state = $model->getState();

            if (!isset($state->document_sort)) {
                $state->insert('document_sort', 'cmd')
                      ->insert('document_direction', 'cmd')
                      ->insert('document_state', 'raw'); // For passing states to document HMVC call
            }

            $model->set($this->getRequest());

            $this->_model = $model;
        }

        return parent::getModel();
    }