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


PHP DataMapper::__construct方法代碼示例

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


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

示例1: stdClass

 function __construct($id = NULL)
 {
     // Set language
     $this->help_lang();
     if (!is_null($id) && ($comic = $this->get_cached($id))) {
         parent::__construct();
         $this->all[0] = new stdClass();
         foreach ($comic->to_array() as $key => $c) {
             $this->{$key} = $c;
             // fill also the all array so result_count() is correctly 1
             $this->all[0]->{$key} = $c;
         }
         if (isset($comic->licenses)) {
             $this->licenses = $comic->licenses;
         }
         if (isset($comic->chapters)) {
             $this->chapters = $comic->chapters;
         }
         return TRUE;
     }
     parent::__construct(NULL);
     // We've overwrote the get() function so we need to look for $id from here
     if (!empty($id) && is_numeric($id)) {
         $this->where('id', $id)->get();
     }
 }
開發者ID:KasaiDot,項目名稱:FoOlSlide,代碼行數:26,代碼來源:comic.php

示例2:

 function __construct($id = NULL)
 {
     parent::__construct(NULL);
     if (!is_null($id)) {
         $this->where('id', $id)->get();
     }
 }
開發者ID:KasaiDot,項目名稱:FoOlSlide,代碼行數:7,代碼來源:page.php

示例3: array

 function __construct($id = NULL)
 {
     parent::__construct($id);
     $my_class = $this->my_class();
     /* runtime relations configuration */
     if (empty(self::$relations)) {
         $this->config->load('relations', TRUE, TRUE);
     }
     if (!isset(self::$relations[$my_class])) {
         self::$relations[$my_class] = array('has_many' => array(), 'has_one' => array());
     }
     $schema = $this->config->item($my_class, 'relations');
     if ($schema) {
         if (isset($schema['has_many'])) {
             self::$relations[$my_class]['has_many'] = array_merge(self::$relations[$my_class]['has_many'], $schema['has_many']);
         }
         if (isset($schema['has_one'])) {
             self::$relations[$my_class]['has_one'] = array_merge(self::$relations[$my_class]['has_one'], $schema['has_one']);
         }
     }
     reset(self::$relations[$my_class]['has_many']);
     foreach (self::$relations[$my_class]['has_many'] as $c => $rel) {
         $this->has_many($c, $rel);
     }
     reset(self::$relations[$my_class]['has_one']);
     foreach (self::$relations[$my_class]['has_one'] as $c => $rel) {
         $this->has_one($c, $rel);
     }
 }
開發者ID:RCMmedia,項目名稱:rubicon,代碼行數:29,代碼來源:MY_Model.php

示例4: __construct

 public function __construct(Database $db, $user)
 {
     parent::__construct($db);
     $this->table('logins');
     $this->columns(array('id', 'users_id', 'unixtime'));
     $this->has_one = array($user);
 }
開發者ID:bamcod,項目名稱:PubCodeHub,代碼行數:7,代碼來源:User.php

示例5: Activity

 function Activity($target = null)
 {
     parent::__construct();
     if ($target) {
         $this->target_class = get_class($target);
         $this->target_id = $target->id;
     }
 }
開發者ID:broofa,項目名稱:socipedia,代碼行數:8,代碼來源:activity.php

示例6:

 function __construct($id = NULL)
 {
     // Set the translations
     $this->help_lang();
     parent::__construct(NULL);
     // We've overwrote some functions, and we need to use the get() from THIS model
     if (!empty($id) && is_numeric($id)) {
         $this->where('id', $id)->get();
     }
 }
開發者ID:KasaiDot,項目名稱:FoOlSlide,代碼行數:10,代碼來源:chapter.php

示例7:

 function __construct($id = NULL)
 {
     $this->CI =& get_instance();
     /*
      $classe = get_class($this) . '_link';
      $link = new $classe;
      $this->has_many = array_merge($this->has_many, $link->has_many);
     */
     parent::__construct($id);
     $this->getModuleStatus();
 }
開發者ID:thomasgroch,項目名稱:quiz,代碼行數:11,代碼來源:datamapperext.php

示例8: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct($id = null)
 {
     $trace = debug_backtrace();
     if ((empty($trace[2]['object']) || !$trace[2]['object'] instanceof DataMapper) && self::$isInstantiated) {
         throw new RuntimeException('System_setting can be instantiated only once!');
     }
     if ($this->hasTable($this->prefix . $this->table)) {
         parent::__construct($id);
     }
     self::$isInstantiated = true;
 }
開發者ID:andrewkrug,項目名稱:repucaution,代碼行數:14,代碼來源:system_setting.php

示例9: IN

 function __construct(\PDO $pdo)
 {
     parent::__construct($pdo);
     // Запрос на выборку самых новых данных каждого типа
     $this->selectLatestStmt = $this->pdo->prepare("SELECT *, DATE_FORMAT(`date`, '%d.%m.%Y') AS new_date FROM news WHERE date IN (SELECT MAX(date) FROM news GROUP BY type) ORDER BY type LIMIT 4");
     $this->selectStmt = $this->pdo->prepare("SELECT *, DATE_FORMAT(`date`, '%d.%m.%Y в %H:%i') AS new_date FROM news WHERE id = ?");
     $this->selectYearsStmt = $this->pdo->prepare("SELECT MAX(DATE_FORMAT(`date`, '%Y')) AS max, MIN(DATE_FORMAT(`date`, '%Y')) AS min FROM news");
     $this->insertStmt = $this->pdo->prepare("INSERT INTO news (title, text, author, type, views, date, img) VALUES (?,?,?,?,?,?,?)");
     $this->updateStmt = $this->pdo->prepare("UPDATE news SET title = ?, type = ?, text = ?, img = ? WHERE id = ?");
     $this->deleteStmt = $this->pdo->prepare("DELETE FROM news WHERE id = ?");
 }
開發者ID:Klym,項目名稱:sp-dnr,代碼行數:11,代碼來源:NewsMapper.php

示例10:

	function __construct($id = NULL) {
		// Set language
		$this->help_lang();

		parent::__construct(NULL);

		// We've overwrote the get() function so we need to look for $id from here
		if (!empty($id) && is_numeric($id)) {
			$this->where('id', $id)->get();
		}
	}
開發者ID:Nakei,項目名稱:FoOlSlide,代碼行數:11,代碼來源:comic.php

示例11: __construct

 public function __construct(Database $db, $user = null)
 {
     parent::__construct($db);
     $this->table('blog');
     $this->columns(array('id', 'title', 'content', 'unixtime'));
     if (!empty($user) && $user instanceof User) {
         $this->has_one = array($user);
     } else {
         $this->has_one = array(new User($db));
     }
 }
開發者ID:bamcod,項目名稱:PubCodeHub,代碼行數:11,代碼來源:Blog.php

示例12: foreach

 function __construct($id = NULL)
 {
     if (!is_null($id) && ($team = $this->get_cached($id))) {
         parent::__construct();
         foreach ($team->to_array() as $key => $t) {
             $this->{$key} = $t;
             // fill also the all array so result_count() is correctly 1
             $this->all[0]->{$key} = $t;
         }
         return TRUE;
     }
     parent::__construct($id);
 }
開發者ID:KasaiDot,項目名稱:FoOlSlide,代碼行數:13,代碼來源:team.php

示例13: array

 function __construct($id = NULL)
 {
     parent::__construct($id);
     $my_class = $this->my_class();
     /* runtime relations configuration */
     if (empty(self::$relations)) {
         $this->config->load('relations', TRUE, TRUE);
     }
     if (!isset(self::$relations[$my_class])) {
         self::$relations[$my_class] = array('has_many' => array(), 'has_one' => array());
     }
     $schema = $this->config->item($my_class, 'relations');
     if ($schema) {
         if (isset($schema['has_many'])) {
             self::$relations[$my_class]['has_many'] = array_merge(self::$relations[$my_class]['has_many'], $schema['has_many']);
         }
         if (isset($schema['has_one'])) {
             self::$relations[$my_class]['has_one'] = array_merge(self::$relations[$my_class]['has_one'], $schema['has_one']);
         }
     }
     reset(self::$relations[$my_class]['has_many']);
     foreach (self::$relations[$my_class]['has_many'] as $c => $rel) {
         $this->has_many($c, $rel);
     }
     reset(self::$relations[$my_class]['has_one']);
     foreach (self::$relations[$my_class]['has_one'] as $c => $rel) {
         $this->has_one($c, $rel);
     }
     /* fill in defaults */
     if (!$id) {
         if ($my_class == 'shift') {
             $my_fields = $this->get_fields();
             foreach ($my_fields as $mf) {
                 if (isset($mf['default'])) {
                     $this->{$mf['name']} = $mf['default'];
                 }
             }
         }
     }
 }
開發者ID:RVRKC,項目名稱:Hackathon_2015,代碼行數:40,代碼來源:MY_Model.php

示例14: __construct

 public function __construct($id = NULL, $abstract = FALSE)
 {
     // ci & mdi
     if (!MDI_Model::$_ci) {
         MDI_Model::$_ci =& get_instance();
     }
     if (!MDI_Model::$_mdi) {
         MDI_Model::$_mdi =& MDI_Model::$_ci->mdi;
     }
     // abstract check
     $is_abstract = $abstract ? TRUE : $this->abstract;
     // abstract
     if ($this->abstract == FALSE) {
         if (empty($this->table)) {
             mdi::error("MDI_Model::__construct Error - table did not defined(model:" . get_class($this) . ")");
         }
     }
     // load syncher
     if ($this->syncher == NULL) {
         MDI_Model::$_ci->mdi->load('features/dbsyncher');
         $this->syncher = new DBSyncher();
     }
     //build validation
     $this->build_validation();
     // construct
     if (!$is_abstract) {
         $is_sync = FALSE;
         if (MDI_Model::$_ci->mdi->config('auto_db_sync')) {
             $is_sync = $this->syncher->sync($this);
         }
         parent::__construct($id);
         $this->initialize();
         if ($is_sync) {
             $this->post_sync();
         }
     }
 }
開發者ID:mehulsbhatt,項目名稱:MDIgniter,代碼行數:37,代碼來源:mdi_model.php

示例15:

 function __construct()
 {
     parent::__construct();
     //$this->load->helper('security');
 }
開發者ID:billyriantono,項目名稱:ihrmis,代碼行數:5,代碼來源:plantilla.php


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