当前位置: 首页>>代码示例>>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;未经允许,请勿转载。