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


PHP Selection::getReferencedTable方法代码示例

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


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

示例1: isset

 public function &__get($key)
 {
     if (array_key_exists($key, $this->data)) {
         $this->access($key);
         return $this->data[$key];
     }
     $column = $this->table->connection->databaseReflection->getReferencedColumn($key, $this->table->name);
     if (array_key_exists($column, $this->data)) {
         $value = $this->data[$column];
         $referenced = $this->table->getReferencedTable($key);
         $ret = isset($referenced[$value]) ? $referenced[$value] : NULL;
         // referenced row may not exist
         return $ret;
     }
     $this->access($key);
     if (array_key_exists($key, $this->data)) {
         return $this->data[$key];
     } else {
         $this->access($key, TRUE);
         $this->access($column);
         if (array_key_exists($column, $this->data)) {
             $value = $this->data[$column];
             $referenced = $this->table->getReferencedTable($key);
             $ret = isset($referenced[$value]) ? $referenced[$value] : NULL;
             // referenced row may not exist
         } else {
             $this->access($column, TRUE);
             trigger_error("Unknown column {$key}", E_USER_WARNING);
             $ret = NULL;
         }
         return $ret;
     }
 }
开发者ID:kovkus,项目名称:r-cms,代码行数:33,代码来源:ActiveRow.php

示例2: getReference

	protected function getReference($table, $column)
	{
		$this->accessColumn($column);
		if (array_key_exists($column, $this->data)) {
			$value = $this->data[$column];
			$referenced = $this->table->getReferencedTable($table, $column, $value);
			return isset($referenced[$value]) ? $referenced[$value] : NULL; // referenced row may not exist
		}

		return FALSE;
	}
开发者ID:nakoukal,项目名称:fakturace,代码行数:11,代码来源:ActiveRow.php

示例3:

 public function &__get($key)
 {
     $this->accessColumn($key);
     if (array_key_exists($key, $this->data)) {
         return $this->data[$key];
     }
     $referenced = $this->table->getReferencedTable($this, $key);
     if ($referenced !== FALSE) {
         $this->accessColumn($key, FALSE);
         return $referenced;
     }
     $this->removeAccessColumn($key);
     throw new Nette\MemberAccessException("Cannot read an undeclared column '{$key}'.");
 }
开发者ID:vladimirslevercz,项目名称:alena,代码行数:14,代码来源:ActiveRow.php

示例4:

 /**
  * @param  string
  * @return ActiveRow|mixed
  * @throws Nette\MemberAccessException
  */
 public function &__get($key)
 {
     if ($this->accessColumn($key)) {
         return $this->data[$key];
     }
     $referenced = $this->table->getReferencedTable($this, $key);
     if ($referenced !== FALSE) {
         $this->accessColumn($key, FALSE);
         return $referenced;
     }
     $this->removeAccessColumn($key);
     $hint = Nette\Utils\ObjectMixin::getSuggestion(array_keys($this->data), $key);
     throw new Nette\MemberAccessException("Cannot read an undeclared column '{$key}'" . ($hint ? ", did you mean '{$hint}'?" : '.'));
 }
开发者ID:nette,项目名称:database,代码行数:19,代码来源:ActiveRow.php

示例5: getReference

 protected function getReference($table, $column)
 {
     if (array_key_exists($column, $this->data)) {
         $this->access($column);
         $value = $this->data[$column];
         $value = $value instanceof ActiveRow ? $value->getPrimary() : $value;
         $referenced = $this->table->getReferencedTable($table, $column, !empty($this->modified[$column]));
         $referenced = isset($referenced[$value]) ? $referenced[$value] : NULL;
         // referenced row may not exist
         if (!empty($this->modified[$column])) {
             // cause saving changed column and prevent regenerating referenced table for $column
             $this->modified[$column] = 0;
             // 0 fails on empty, pass on isset
         }
         return $referenced;
     }
 }
开发者ID:exesek,项目名称:nette20login,代码行数:17,代码来源:ActiveRow.php


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