/** * @param int $type */ public function __construct($type) { $this->_type = (int) $type; $source = new CM_PagingSource_Sql_Deferred('string', 'cm_string', '`type`=' . $this->_type, 'string ASC'); $source->enableCache(); parent::__construct($source); }
/** * @param CM_Model_Language $language * @param bool|null $javascriptOnly */ public function __construct(CM_Model_Language $language, $javascriptOnly = null) { $this->_language = $language; $this->_javascriptOnly = (bool) $javascriptOnly; $where = null; if ($javascriptOnly) { $where = 'k.javascript = 1'; // Include the javascript version in the cache key, so the paging invalidates when the version changes. $javascriptVersion = CM_Model_Language::getVersionJavascript(); $where .= " AND '{$javascriptVersion}' = '{$javascriptVersion}'"; } $orderBy = 'k.name ASC'; $join = 'LEFT JOIN `cm_languageValue` AS v ON k.id = v.languageKeyId AND v.languageId = ' . $this->_language->getId() . ' '; $groupBy = 'BINARY k.name'; $source = new CM_PagingSource_Sql_Deferred('k.name AS `key`, v.value, k.variables', 'cm_model_languagekey` as `k', $where, $orderBy, $join, $groupBy); $source->enableCache(null, CM_Cache_Persistent::getInstance()); parent::__construct($source); }