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

getCategory() public static method

Get a category
public static getCategory ( string $url ) : array
$url string
return array
    public static function getCategory($url)
    {
        return (array) FrontendModel::getContainer()->get('database')->getRecord('SELECT i.*, m.url
             FROM faq_categories AS i
             INNER JOIN meta AS m ON i.meta_id = m.id
             WHERE m.url = ? AND i.language = ?
             ORDER BY i.sequence', array((string) $url, LANGUAGE));
    }

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::getCategory($this->URL->getParameter(1));
     // anything found?
     if (empty($this->record)) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     $this->record['full_url'] = FrontendNavigation::getURLForBlock('Faq', 'Category') . '/' . $this->record['url'];
     $this->questions = FrontendFaqModel::getAllForCategory($this->record['id']);
 }