/**
  * Gets the value from session and input and sets it back to session
  *
  * @param string $name
  * @param string $inputName
  * @param mixed  $default
  * @param string $filter
  * @param string $namespace
  *
  * @return  mixed
  */
 public function getUserStateFromInput($name, $inputName, $default = null, $filter = InputFilter::STRING, $namespace = 'default')
 {
     $oldState = $this->getUserState($name, $default, $namespace);
     $newState = $this->input->get($inputName, null, $filter);
     // Id state different, reset page to 1.
     if ($oldState != $newState) {
         $this->setUserState($this->getContext('list.page'), 1);
     }
     return parent::getUserStateFromInput($name, $inputName, $default, $filter, $namespace);
 }
 /**
  * prepareExecute
  *
  * @return  void
  *
  * @throws \LogicException
  * @throws \DomainException
  */
 protected function prepareExecute()
 {
     parent::prepareExecute();
     $this->model = $this->getModel();
     $this->dataObject = $this->getDataObject();
     $this->task = $this->input->get('task');
     // Determine model
     if (!$this->model instanceof CrudRepositoryInterface) {
         throw new \DomainException(sprintf('%s model should be instance of %s, class: %s', $this->model->getName(), CrudRepositoryInterface::class, get_class($this->model)));
     }
     // Determine the name of the primary key for the data.
     if (empty($this->keyName)) {
         $this->keyName = $this->model->getKeyName(false) ?: 'id';
     }
     $this->checkAccess($this->dataObject);
 }
 /**
  * getView
  *
  * @param string $name
  * @param string $format
  * @param string $engine
  * @param bool   $forceNew
  *
  * @return AbstractView|HtmlView
  *
  * @throws \UnexpectedValueException
  */
 public function getView($name = null, $format = null, $engine = null, $forceNew = false)
 {
     $format = $format ?: $this->format;
     if ($name) {
         return parent::getView($name, $format, $engine, $forceNew);
     }
     if (!$this->view instanceof AbstractView || $forceNew) {
         $this->view = parent::getView($this->view, $format, $engine, $forceNew);
     }
     return $this->view;
 }