本文整理汇总了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;
}
}
示例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;
}
示例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}'.");
}
示例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}'?" : '.'));
}
示例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;
}
}