*/
protected function getCacheKeyByCriteria (Criteria $criteriaInstance, array $onlyKeys = array()) {
// Generate it
- $cacheKey = sprintf("%s@%s",
+ $cacheKey = sprintf('%s@%s',
$this->__toString(),
$criteriaInstance->getCacheKey($onlyKeys)
);
foreach ($this->getGenericArrayKey('criteria', $criteriaType, 'entries') as $criteriaKey => $criteriaValue) {
// Make sure no 'my-' or 'my_' passes this point
assert((strpos($criteriaKey, 'my-') === FALSE) && (strpos($criteriaKey, 'my_') === FALSE) && (!is_bool($criteriaValue)));
+
+ // $criteriaValue cannot be an array
assert(!is_array($criteriaValue));
// Convert dashes to underscore
// Is the value in array or is $onlyKeys empty?
if ((isset($onlyKeys[$criteriaKey])) || (count($onlyKeys) == 0)) {
// Add the value URL encoded to avoid any trouble with special characters
- $cacheKey .= sprintf("%s=%s;",
+ $cacheKey .= sprintf('%s=%s;',
$criteriaKey,
urlencode($criteriaValue)
);
// Check if 'limit' and 'skip' are in
if (((isset($onlyKeys['limit'])) && (isset($onlyKeys['skip']))) || (count($onlyKeys) == 0)) {
// Add limit and skip values
- $cacheKey .= sprintf(";%%limit%%=%s;%%skip%%=%s",
+ $cacheKey .= sprintf(';%%limit%%=%s;%%skip%%=%s',
$this->getLimit(),
$this->getSkip()
);
// Does this key exists in cache?
if ($this->cacheInstance->offsetExists($cacheKey, BaseDatabaseBackend::RESULT_INDEX_ROWS, 1)) {
// Debug message
- //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-WRAPPER: Cache used for cacheKey=' . $cacheKey . ':' . print_r($this->cacheInstance->offsetGet($cacheKey), TRUE));
+ /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-WRAPPER: Cache used for cacheKey=' . $cacheKey . ':' . print_r($this->cacheInstance->offsetGet($cacheKey), TRUE));
// Then use this result
$result = $this->cacheInstance->offsetGet($cacheKey);
} else {
// Debug message
- //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-WRAPPER: Quering database, cacheKey=' . $cacheKey);
+ /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-WRAPPER: Quering database, cacheKey=' . $cacheKey);
// Now it's time to ask the database layer for this select statement
$result = $this->getDatabaseInstance()->doSelectByTableCriteria($this->getTableName(), $criteriaInstance);