当前位置: 首页>>代码示例>>PHP>>正文


PHP ORM::configure方法代码示例

本文整理汇总了PHP中ORM::configure方法的典型用法代码示例。如果您正苦于以下问题:PHP ORM::configure方法的具体用法?PHP ORM::configure怎么用?PHP ORM::configure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ORM的用法示例。


在下文中一共展示了ORM::configure方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * When creating the model, the configs for database connection creation are needed
  * @param $config
  */
 public function __construct($config)
 {
     //ORM::configure('logging', true);
     ORM::configure("mysql:host={$config['db_host']};dbname={$config['db_name']};port={$config['db_port']};charset=utf8");
     ORM::configure('username', $config['db_user']);
     ORM::configure('password', $config['db_pass']);
 }
开发者ID:harshid86,项目名称:QuizExample,代码行数:11,代码来源:entities.php

示例2: configureDb

 /**
  * Set the database name, username and password
  */
 function configureDb($database, $username, $password)
 {
     \ORM::configure("mysql:host=localhost;dbname={$database};charset=utf8mb4");
     \ORM::configure('username', $username);
     \ORM::configure('password', $password);
     $this->config->set("data.dbName", $database);
 }
开发者ID:NeonPaul,项目名称:abode,代码行数:10,代码来源:Abode.php

示例3: __construct

 public function __construct()
 {
     require 'idiorm.php';
     ORM::configure('mysql:host=localhost;dbname=etutor');
     ORM::configure('username', 'root');
     ORM::configure('password', 'pass');
 }
开发者ID:sooraj007,项目名称:etutor,代码行数:7,代码来源:chapter.php

示例4: dbInsert

function dbInsert($row, $user)
{
    ORM::configure(array('connection_string' => 'mysql:host=localhost;dbname=qiita', 'username' => 'xxxx', 'password' => 'xxxx', 'driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'), 'error_mode', PDO::ERRMODE_WARNING, 'logging', true));
    //記事登録
    $items = ORM::for_table('items')->where_equal('item_id', $row['item_id'])->find_one();
    if (!$items) {
        //未登録の記事は登録
        $items = ORM::for_table('items')->create();
        $items->set($row);
        $items->save();
    }
    //ユーザ情報登録
    $users = ORM::for_table('users')->where_equal('user_id', $user['user_id'])->find_one();
    print_r($user);
    echo $user['user_id'];
    if (!$users) {
        //未登録のユーザは登録
        $users = ORM::for_table('users')->create();
        $users->set($user);
        echo " 登録<br>";
    } else {
        //登録済のユーザは更新
        $users->set($user);
        echo " 更新<br>";
    }
    $users->save();
}
开发者ID:bzz0217,项目名称:qiita_items,代码行数:27,代码来源:index.php

示例5: idiorm

 private function idiorm($path)
 {
     if (!mapi_include_abs_path($path, 'lib')) {
         return null;
     }
     if (!isset(MSettings::$db_host) || !strlen(MSettings::$db_host) > 0) {
         return false;
     }
     if (!isset(MSettings::$db) || !strlen(MSettings::$db) > 0) {
         return false;
     }
     if (!isset(MSettings::$db_user) || !strlen(MSettings::$db_user) > 0) {
         return false;
     }
     if (!isset(MSettings::$db_pass) || !strlen(MSettings::$db_pass) > 0) {
         return false;
     }
     try {
         ORM::configure('mysql:host=' . MSettings::$db_host . ';dbname=' . MSettings::$db);
         ORM::configure('username', MSettings::$db_user);
         ORM::configure('password', MSettings::$db_pass);
         ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
         $test = ORM::for_table('preferences')->create();
         if ($test) {
             return true;
         } else {
             return false;
         }
     } catch (PDOException $e) {
         return false;
     }
 }
开发者ID:adncentral,项目名称:mapi-geoCMS,代码行数:32,代码来源:libraries.php

示例6: updateRowRoute

 /**
  * Create POST route for updating a row
  */
 protected function updateRowRoute()
 {
     // Save Model
     $this->app->post('/{table}/save', function ($request, $response, $args) {
         $newResponse = $response->withHeader('Content-type', 'application/json');
         try {
             // Get primary key of table from response
             $primary_key = $request->getParam('primary_key');
             // Get primary key value of this model from response
             $primary_key_value = $request->getParam('params')[$primary_key];
             // Set table's primary key for saving model
             ORM::configure('id_column_overrides', array($args['table'] => $primary_key));
             // Create model from query, set new parameters, and save it
             $model = ORM::for_table($args['table'])->where($primary_key, intval(6))->find_many()[0];
             $model->set($request->getParam('params'));
             $success = $model->save();
             $response_body = array("success" => $success);
         } catch (Exception $e) {
             error_log(ORM::get_last_statement()->queryString);
             error_log($e->getMessage());
             $response_body = array("error" => $e->getMessage());
         }
         // Add data to response in JSON format
         $newResponse->write(json_encode($response_body));
         return $newResponse;
     });
 }
开发者ID:gholme4,项目名称:Qbuild,代码行数:30,代码来源:Qbuild.php

示例7: tearDown

 public function tearDown()
 {
     ORM::configure('logging', false);
     ORM::configure('logging', false, self::ALTERNATE);
     ORM::set_db(null);
     ORM::set_db(null, self::ALTERNATE);
 }
开发者ID:arunkapil,项目名称:Granada,代码行数:7,代码来源:MultipleConnectionsTest.php

示例8: __construct

 public function __construct()
 {
     \ORM::configure('mysql:host=localhost;dbname=igorpronin_list');
     \ORM::configure('username', 'igorpronin_list');
     \ORM::configure('password', '');
     //todo скрыть при размещении на github
 }
开发者ID:EvgeniyaPronina,项目名称:Is_front_dz3,代码行数:7,代码来源:Model.php

示例9: connect

function connect()
{
    ORM::configure('mysql:host=localhost;dbname=fake');
    ORM::configure('username', 'root');
    ORM::configure('password', 'root');
    ORM::configure('error_mode', PDO::ERRMODE_WARNING);
}
开发者ID:SimplonTlse,项目名称:MiniCRM,代码行数:7,代码来源:functions.php

示例10: __construct

 public function __construct()
 {
     ORM::configure('mysql:host=localhost;dbname=loft_shop');
     ORM::configure('username', 'root');
     ORM::configure('password', '');
     ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
     ORM::configure('id_column_overrides', array('user_group' => array('id_user', 'id_group')));
 }
开发者ID:Antoshka007,项目名称:php_dz5,代码行数:8,代码来源:model.php

示例11: connect

function connect()
{
    ORM::configure('mysql:host=localhost;dbname=crm');
    ORM::configure('username', 'root');
    ORM::configure('password', 'MOTDEPASSE');
    ORM::configure('error_mode', PDO::ERRMODE_WARNING);
    ORM::configure('return_result_sets', true);
}
开发者ID:nemo75,项目名称:sql,代码行数:8,代码来源:functions.php

示例12: database

function database()
{
    ORM::configure('mysql:host=localhost;dbname=fake');
    ORM::configure('username', 'root');
    ORM::configure('password', 'root');
    ORM::configure('error_mode', PDO::ERRMODE_WARNING);
    ORM::configure('return_result_sets', true);
}
开发者ID:AmbreB,项目名称:ExercicesSimplon,代码行数:8,代码来源:function.php

示例13: connect

 protected function connect()
 {
     ORM::configure('mysql:host=' . $this->config["db"]["host"] . ";dbname=" . $this->config["db"]["dbname"]);
     ORM::configure('username', $this->config["db"]["username"]);
     ORM::configure('password', $this->config["db"]["password"]);
     ORM::configure('error_mode', PDO::ERRMODE_WARNING);
     ORM::configure('return_result_sets', true);
 }
开发者ID:AmbreB,项目名称:Senny,代码行数:8,代码来源:Model.php

示例14: run

    public function run()
    {
        $spider_name = isset($_REQUEST['spider']) ? $_REQUEST['spider'] : '';
        $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
        $title = 'Spider';
        $spider = $this->get_spider($spider_name);
        if ($spider) {
            $title = $spider->get_title();
            // DB
            $dbpath = $spider->get_db_path();
            $empty_database = false;
            if (!is_file($dbpath)) {
                touch($dbpath);
                $empty_database = true;
            }
            $dbpath = realpath($dbpath);
            ORM::configure('sqlite:' . $dbpath);
            if ($empty_database) {
                $spider->create_database();
            }
        }
        // header
        include '_header.php';
        // loaded with bootstrap
        // process
        ?>
		<ul class="nav nav-tabs">
			<?php 
        $this->print_menu('Fakku');
        ?>
			<?php 
        $this->print_menu('Hbrowse');
        ?>
			<?php 
        $this->print_menu('HentaiMangaOnline');
        ?>
			<?php 
        $this->print_menu('FreeHManga');
        ?>
		</ul>
		<div class="container">
	<?php 
        if ($spider) {
            $method = 'action_' . $action;
            if (method_exists($spider, $method)) {
                $spider->{$method}();
            } else {
                echo 'Choose something';
            }
        } else {
            echo 'Select Spider';
        }
        ?>
		</div>
	<?php 
        // footer
        include '_footer.php';
    }
开发者ID:JerryMaheswara,项目名称:crawler,代码行数:58,代码来源:spider.php

示例15: setUp

 public function setUp()
 {
     // Enable logging
     ORM::configure('logging', true);
     ORM::configure('caching', false);
     // Set up the dummy database connection
     $db = new DummyPDO('sqlite::memory:');
     ORM::setDatabase($db);
 }
开发者ID:kevinsperrine,项目名称:paris,代码行数:9,代码来源:ModelTest.php


注:本文中的ORM::configure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。