Example #1
0
 function __construct()
 {
     $app = \Slim\Slim::getInstance();
     include_once BASE_PATH . 'vendor/sparrow.php';
     $db = new Sparrow();
     $db->setDb(array('type' => 'mysqli', 'hostname' => $app->config['db']['hostname'], 'database' => $app->config['db']['database'], 'username' => $app->config['db']['username'], 'password' => $app->config['db']['password']));
     $db->sql('SET NAMES utf8')->execute();
     $this->db = $db;
     $app->db = $db;
 }
Example #2
0
 public function create($email)
 {
     return $this->db->from('users')->insert(array('email' => $this->db->escape($email)))->execute();
 }
Example #3
0
 public function create($data)
 {
     $data['user_id'] = $_SESSION['user']['user_id'];
     return $this->db->from('comments')->insert($data)->execute();
 }
Example #4
0
 public function getTalkById($talkId)
 {
     return $this->db->from('talks')->where('talk_id = ', $talkId)->one();
 }
 public function getCategoryById($categoryId)
 {
     return $this->db->from('categories')->where('category_id = ', $categoryId)->one();
 }
Example #6
0
<?php

require dirname(__FILE__) . '/../lib/halcyon.php';
class Sparrow extends Halcyon
{
    public function greet($name)
    {
        return $this->get("/greet/{$name}");
    }
}
try {
    $client = new Sparrow('http://localhost:4647/');
    print $client->greet($argv[1] ? $argv[1] : 'Matt')->body . "\n";
} catch (HalcyonError $e) {
    print "ERROR: " . $e->getMessage() . "\n";
}