當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Data::getObject方法代碼示例

本文整理匯總了PHP中Data::getObject方法的典型用法代碼示例。如果您正苦於以下問題:PHP Data::getObject方法的具體用法?PHP Data::getObject怎麽用?PHP Data::getObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Data的用法示例。


在下文中一共展示了Data::getObject方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: save

 public static function save($id)
 {
     $res = Data::query('movie', 'id_ac = ' . $id);
     if (!count($res)) {
         $info = static::getInfosMovie($id);
         $info['id_ac'] = $id;
         $info['id_video'] = null;
         $info['plateforme'] = null;
         $movie = Data::getById('movie', Data::add('movie', $info));
     } else {
         $movie = Data::getObject(current($res));
     }
     return $movie;
 }
開發者ID:schpill,項目名稱:thin,代碼行數:14,代碼來源:Allocine.php

示例2: checkTimeout

 public function checkTimeout()
 {
     $sessions = parent::query('thinsession', 'expire < ' . time());
     if (count($sessions)) {
         foreach ($sessions as $session) {
             $session = parent::getObject($session);
             $delete = parent::delete('thinsession', $session->getId());
         }
     }
 }
開發者ID:schpill,項目名稱:thin,代碼行數:10,代碼來源:Sessionbis.php

示例3: forget

 /**
  * Delete an item from the cache.
  *
  * @param  string  $key
  * @return void
  */
 public function forget($key)
 {
     $this->_cleanCache();
     $res = Data::query('cache', 'key = ' . $key . ' && namespace = ' . $this->namespace);
     if (count($res)) {
         $obj = Data::getObject(current($res));
         $del = Data::delete('cache', $obj->getId());
     }
 }
開發者ID:schpill,項目名稱:thin,代碼行數:15,代碼來源:Cachedata.php

示例4: join

 public function join($fkTable, $condition)
 {
     $joinResults = array();
     $db = new \SQLite3(':memory:');
     $results = count($this->results) ? $this->results : $this->all()->sub();
     $fields = Arrays::exists($fkTable, Data::$_fields) ? Data::$_fields[$fkTable] : Data::noConfigFields($fkTable);
     $q = "DROP TABLE IF EXISTS {$fkTable}; CREATE TABLE {$fkTable} (id VARCHAR PRIMARY KEY, date_create";
     if (count($fields)) {
         foreach ($fields as $field => $infos) {
             $q .= ", {$field}";
         }
     }
     $q .= ");";
     $db->exec($q);
     $datas = Data::getAll($fkTable);
     foreach ($datas as $tmpObject) {
         $object = Data::getObject($tmpObject, $fkTable);
         $q = "INSERT INTO {$fkTable} (id, date_create) VALUES ('" . \SQLite3::escapeString($object->id) . "', '" . \SQLite3::escapeString($object->date_create) . "')";
         $db->exec($q);
         foreach ($fields as $field => $info) {
             $q = "UPDATE {$fkTable} SET {$field} = '" . \SQLite3::escapeString($object->{$field}) . "' WHERE id = '" . \SQLite3::escapeString($object->id) . "'";
             $db->exec($q);
         }
     }
     $fields = Arrays::exists($this->type, Data::$_fields) ? Data::$_fields[$this->type] : Data::noConfigFields($this->type);
     $q = "DROP TABLE IF EXISTS {$this->type}; CREATE TABLE {$this->type} (id VARCHAR PRIMARY KEY, date_create";
     if (count($fields)) {
         foreach ($fields as $field => $infos) {
             $q .= ", {$field}";
         }
     }
     $q .= ");";
     $db->exec($q);
     $datas = Data::getAll($this->type);
     foreach ($datas as $tmpObject) {
         $object = Data::getObject($tmpObject, $this->type);
         $q = "INSERT INTO {$this->type} (id, date_create) VALUES ('" . \SQLite3::escapeString($object->id) . "', '" . \SQLite3::escapeString($object->date_create) . "')";
         $db->exec($q);
         foreach ($fields as $field => $info) {
             $q = "UPDATE {$this->type} SET {$field} = '" . \SQLite3::escapeString($object->{$field}) . "' WHERE id = '" . \SQLite3::escapeString($object->id) . "'";
             $db->exec($q);
         }
     }
     list($field, $op, $value) = explode(' ', $condition, 3);
     $where = "{$fkTable}.{$field} {$op} '" . \SQLite3::escapeString($value) . "'";
     $q = "SELECT {$this->type}.id\n            FROM {$this->type}\n            LEFT JOIN {$fkTable} ON {$this->type}.{$fkTable} = {$fkTable}.id\n            WHERE {$where}\n            ";
     $res = $db->query($q);
     while ($row = $res->fetchArray()) {
         array_push($joinResults, $row['id']);
     }
     if (count($joinResults)) {
         $this->results = $joinResults;
     }
     return $this;
 }
開發者ID:schpill,項目名稱:thin,代碼行數:55,代碼來源:Querydata.php


注:本文中的Data::getObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。