예제 #1
0
 public static function run()
 {
     \Tasks_Database::initDB();
     self::addUsers();
     self::addProducts();
     self::addOrders();
 }
예제 #2
0
 public static function initDB()
 {
     self::$USER_TABLE = Model_User::table();
     self::$PRODUCT_TABLE = Model_Product::table();
     self::$ORDER_TABLE = Model_Order::table();
     self::$JOIN_TABLE = Model_OrderProduct::table();
     self::$CATEGORY_TABLE = Model_Category::table();
     Config::load('development/db.php');
     $which = Config::get('which');
     echo "\nwhich = {$which}\n";
     if ($which == "sqlite") {
         self::initSQLite();
     }
     $dsn = Config::get('default.connection.dsn');
     $username = Config::get('default.connection.username');
     $password = Config::get('default.connection.password');
     $cx = new PDO($dsn, $username, $password);
     self::dropAll($cx);
     self::createTables($cx, $which);
 }