Doctrine\Common\Cache\SQLite3Cache::findById PHP Method

findById() private method

Find a single row by ID.
private findById ( mixed $id, boolean $includeData = true ) : array | null
$id mixed
$includeData boolean
return array | null
    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;
    }