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


PHP Selection::getConnection方法代碼示例

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


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

示例1: access

 /**
  * @internal
  */
 public function access($key, $cache = TRUE)
 {
     if ($this->table->getConnection()->getCache() && !isset($this->modified[$key]) && $this->table->access($key, $cache)) {
         $id = isset($this->data[$this->table->getPrimary()]) ? $this->data[$this->table->getPrimary()] : $this->data;
         $this->data = $this->table[$id]->data;
     }
 }
開發者ID:JanVoracek,項目名稱:nette,代碼行數:10,代碼來源:ActiveRow.php

示例2: buildJoins

 protected function buildJoins($val, $inner = FALSE)
 {
     $driver = $this->selection->getConnection()->getSupplementalDriver();
     $reflection = $this->selection->getConnection()->getDatabaseReflection();
     $joins = array();
     preg_match_all('~\\b([a-z][\\w.:]*[.:])([a-z]\\w*|\\*)(\\s+IS\\b|\\s*<=>)?~i', $val, $matches);
     foreach ($matches[1] as $names) {
         $parent = $this->selection->getName();
         if ($names !== "{$parent}.") {
             // case-sensitive
             preg_match_all('~\\b([a-z][\\w]*|\\*)([.:])~i', $names, $matches, PREG_SET_ORDER);
             foreach ($matches as $match) {
                 list(, $name, $delimiter) = $match;
                 if ($delimiter === ':') {
                     list($table, $primary) = $reflection->getHasManyReference($parent, $name);
                     $column = $reflection->getPrimary($parent);
                 } else {
                     list($table, $column) = $reflection->getBelongsToReference($parent, $name);
                     $primary = $reflection->getPrimary($table);
                 }
                 $joins[$name] = ' ' . (!isset($joins[$name]) && $inner && !isset($match[3]) ? 'INNER' : 'LEFT') . ' JOIN ' . $driver->delimite($table) . ($table !== $name ? ' AS ' . $driver->delimite($name) : '') . ' ON ' . $driver->delimite($parent) . '.' . $driver->delimite($column) . ' = ' . $driver->delimite($name) . '.' . $driver->delimite($primary);
                 $parent = $name;
             }
         }
     }
     return $joins;
 }
開發者ID:cujan,項目名稱:atlas-mineralov-a-hornin,代碼行數:27,代碼來源:SqlBuilder.php

示例3: list

 public function &__get($key)
 {
     $this->accessColumn($key);
     if (array_key_exists($key, $this->data)) {
         return $this->data[$key];
     }
     list($table, $column) = $this->table->getConnection()->getDatabaseReflection()->getBelongsToReference($this->table->getName(), $key);
     $referenced = $this->getReference($table, $column);
     if ($referenced !== FALSE) {
         $this->accessColumn($key, FALSE);
         return $referenced;
     }
     $this->removeAccessColumn($key);
     throw new Nette\MemberAccessException("Cannot read an undeclared column \"{$key}\".");
 }
開發者ID:vrtak-cz,項目名稱:nette-doctrine-sandbox,代碼行數:15,代碼來源:ActiveRow.php


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