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


PHP DatabaseFactory::get_provider方法代码示例

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


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

示例1: register_on_db

 private function register_on_db($cinema)
 {
     //o nome da classe é o id do banco, recupera dinamico
     $classname = get_class($this);
     $cinema->_id = $classname;
     $db = DatabaseFactory::get_provider();
     $cinema_db = $db->find($classname);
     if ($cinema_db) {
         if ($cinema_db->hash != $cinema->hash) {
             $cinema->_rev = $cinema_db->_rev;
             //utilizado mais para ter uma nocao olhando direto no banco...
             $cinema->last_update = date('d/m/y H:i:s');
             $db->save($cinema);
             //atributo utilizado para filtrar cinemas que foram atualizados para notificar clientes de atualizacao uma unica vez.
             //seta o valor temporariamente, não guarda no db, so para validacao
             $cinema->updated = 'YES';
             //Log::write($cinema->name . ' tem novidades');
         }
     } else {
         $cinema->last_update = date('d/m/y H:i:s');
         $db->save($cinema);
         $cinema->updated = 'YES';
     }
     if (!isset($cinema->updated)) {
         //controle so de validacao
         $cinema->updated = 'NO';
     }
     return $cinema;
 }
开发者ID:xxdf,项目名称:showtimes,代码行数:29,代码来源:AbstractCinemaAdapter.php

示例2: callback_subscribers

function callback_subscribers($cinemas)
{
    $cinemas_updated = base64_encode(json_encode($cinemas));
    $db = DatabaseFactory::get_provider();
    $subscribers = $db->get_subscribers();
    foreach ($subscribers as $subscriber) {
        $url = $subscriber->value->callback;
        post_request($url, $cinemas_updated);
    }
}
开发者ID:xxdf,项目名称:showtimes,代码行数:10,代码来源:update-showtimes.php

示例3: ini_set

ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
$domain = 'http://' . $_SERVER['HTTP_HOST'];
$root_path = realpath($_SERVER["DOCUMENT_ROOT"]);
//recebe do htaccess mod_rewrite para saber quem chamou.
$query_path = $_REQUEST['id'];
if (is_dir("{$root_path}/{$query_path}")) {
    $dir = "{$root_path}/{$query_path}";
    $dir_list = array();
    foreach (scandir($dir) as $key => $value) {
        //desconsidera . e .. como diretorios
        if (preg_match("/^[\\w]/", $value)) {
            //troca a extensao do arquivo se existir para .json
            $name = preg_replace('/\\..+$/', '.json', $value);
            $url = "{$domain}/{$query_path}{$name}";
            $dir_list[] = array("name" => $name, "url" => $url);
        }
    }
    Helper::print_json($dir_list);
} else {
    $classname = basename($query_path, '.json');
    //procura a classe no json se encontrar retorna ela... bem mais rapido que IO
    $db = DatabaseFactory::get_provider();
    $data = $db->find($classname);
    if ($data) {
        Helper::print_json($data);
        return;
    }
    $object = new $classname();
    $object->print_json();
}
开发者ID:xxdf,项目名称:showtimes,代码行数:31,代码来源:dispatch.php

示例4: test_clean_database

 function test_clean_database()
 {
     $db = DatabaseFactory::get_provider();
     $db->clean_database();
 }
开发者ID:xxdf,项目名称:showtimes,代码行数:5,代码来源:BasicTest.php


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