Ejemplo n.º 1
0
 public static function getAllMessages()
 {
     try {
         $pdo = Util::getPDO();
         $result = $pdo->query("SELECT * FROM message ORDER BY moment DESC");
         return $result->fetchAll(PDO::FETCH_CLASS, 'Chat\\Message');
     } catch (PDOException $e) {
         return false;
     }
 }
Ejemplo n.º 2
0
 public function restaurantSelect()
 {
     // load model with Transaction instance
     $restaurant = new Restaurant($this->db_transaction);
     // open connection
     $this->db_transaction->connect();
     // select with where, order by, limit(pagination) and join left
     // $restaurant_list = $restaurant
     //     ->where([
     //         'restaurant.id' => [15,16],])
     //     ->orderBy([
     //         'restaurant.serves_pizza' => 'desc'])
     //     ->limit(1,5)
     //     ->update([
     //         'place' => 'testandiooo123654'])
     //     ->execute([
     //         'join' => 'left']);
     // select with update and return changes
     $restaurant_list = $restaurant->where(['restaurant.serves_hot_dogs' => [1, 0]])->orderBy(['restaurant.serves_pizza' => 'desc'])->limit(1, 5)->update(['place' => 'place update yea!'])->execute(['join' => 'left']);
     // join left|right optional
     // list of query's
     // Util::renderToJson($restaurant->dumpQuery());
     // render to json result
     Util::renderToJson($restaurant_list);
 }
Ejemplo n.º 3
0
<?php

$pathItems = explode(PATH_SEPARATOR, get_include_path());
$pathItems[] = dirname(__FILE__) . '/../library';
$pathItems[] = dirname(__FILE__) . '/../app/models';
set_include_path(implode(PATH_SEPARATOR, $pathItems));
require_once 'Bootstrap.php';
try {
    Bootstrap::init();
    Bootstrap::run();
} catch (Exception $e) {
    echo $e->getMessage();
    echo "<pre>" . $e->getTraceAsString() . "</pre>";
    \Core\Util::sendErrorMail($e);
}
Ejemplo n.º 4
0
 public function save($data)
 {
     $data['password'] = \Core\Util::encrypt($data['password']);
     parent::save($data);
 }