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

get() public static method

Fetch a question
public static get ( string $url ) : array
$url string
return array
    public static function get($url)
    {
        return (array) FrontendModel::getContainer()->get('database')->getRecord('SELECT i.*, m.url, c.title AS category_title, m2.url AS category_url
             FROM faq_questions AS i
             INNER JOIN meta AS m ON i.meta_id = m.id
             INNER JOIN faq_categories AS c ON i.category_id = c.id
             INNER JOIN meta AS m2 ON c.meta_id = m2.id
             WHERE m.url = ? AND i.language = ? AND i.hidden = ?
             ORDER BY i.sequence', array((string) $url, LANGUAGE, 'N'));
    }

Usage Example

Beispiel #1
0
 /**
  * Load the data, don't forget to validate the incoming data
  */
 private function getData()
 {
     // validate incoming parameters
     if ($this->URL->getParameter(1) === null) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // get by URL
     $this->record = FrontendFaqModel::get($this->URL->getParameter(1));
     // anything found?
     if (empty($this->record)) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // overwrite URLs
     $this->record['category_full_url'] = FrontendNavigation::getURLForBlock('Faq', 'Category') . '/' . $this->record['category_url'];
     $this->record['full_url'] = FrontendNavigation::getURLForBlock('Faq', 'Detail') . '/' . $this->record['url'];
     // get tags
     $this->record['tags'] = FrontendTagsModel::getForItem('Faq', $this->record['id']);
     // get settings
     $this->settings = $this->get('fork.settings')->getForModule('Faq');
     // reset allow comments
     if (!$this->settings['allow_feedback']) {
         $this->record['allow_feedback'] = false;
     }
     // ge status
     $this->status = $this->URL->getParameter(2);
     if ($this->status == FL::getAction('Success')) {
         $this->status = 'success';
     }
     if ($this->status == FL::getAction('Spam')) {
         $this->status = 'spam';
     }
 }