Backend\Modules\Faq\Engine\Model::get PHP Method

get() public static method

Fetch a question
public static get ( integer $id ) : array
$id integer
return array
    public static function get($id)
    {
        return (array) BackendModel::getContainer()->get('database')->getRecord('SELECT i.*, m.url
             FROM faq_questions AS i
             INNER JOIN meta AS m ON m.id = i.meta_id
             WHERE i.id = ? AND i.language = ?', array((int) $id, BL::getWorkingLanguage()));
    }

Usage Example

Example #1
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     if ($this->id !== null && BackendFaqModel::exists($this->id)) {
         parent::execute();
         $this->record = BackendFaqModel::get($this->id);
         // delete item
         BackendFaqModel::delete($this->id);
         BackendModel::triggerEvent($this->getModule(), 'after_delete', array('item' => $this->record));
         $this->redirect(BackendModel::createURLForAction('Index') . '&report=deleted&var=' . rawurlencode($this->record['question']));
     } else {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
All Usage Examples Of Backend\Modules\Faq\Engine\Model::get