private function SQLite3Cache::findById in Plug 7
Find a single row by ID.
Parameters
mixed $id:
boolean $includeData:
Return value
array|null
2 calls to SQLite3Cache::findById()
- SQLite3Cache::doContains in lib/
doctrine/ cache/ lib/ Doctrine/ Common/ Cache/ SQLite3Cache.php - Tests if an entry exists in the cache.
- SQLite3Cache::doFetch in lib/
doctrine/ cache/ lib/ Doctrine/ Common/ Cache/ SQLite3Cache.php - Fetches an entry from the cache.
File
- lib/
doctrine/ cache/ lib/ Doctrine/ Common/ Cache/ SQLite3Cache.php, line 164
Class
- SQLite3Cache
- SQLite3 cache provider.
Namespace
Doctrine\Common\CacheCode
private function findById($id, $includeData = true) {
list($idField) = $fields = $this
->getFields();
if (!$includeData) {
$key = array_search(static::DATA_FIELD, $fields);
unset($fields[$key]);
}
$statement = $this->sqlite
->prepare(sprintf('SELECT %s FROM %s WHERE %s = :id LIMIT 1', implode(',', $fields), $this->table, $idField));
$statement
->bindValue(':id', $id, SQLITE3_TEXT);
$item = $statement
->execute()
->fetchArray(SQLITE3_ASSOC);
if ($item === false) {
return null;
}
if ($this
->isExpired($item)) {
$this
->doDelete($id);
return null;
}
return $item;
}