/** * Load the model state from the request * * This functions merges the request information with any model state information that was saved in the session and * returns the result. * * @param ControllerContextModel $context The active controller context * @return void */ protected function _beforeBrowse(ControllerContextModel $context) { $query = $context->getRequest()->query; $query->add((array) $context->user->get($this->_getStateKey($context))); $this->getModel()->getState()->setValues($query->toArray()); }
/** * Fetch the model entity * * @param ControllerContextModel $context A controller context object * @return void */ protected function _fetchEntity(ControllerContextModel $context) { if (!$context->result instanceof ModelEntityInterface) { switch ($context->action) { case 'add': $context->setEntity($this->getModel()->create($context->request->data->toArray())); break; case 'edit': case 'delete': $context->setEntity($this->getModel()->fetch()); break; } } else { $context->setEntity($context->result); } }