本文整理匯總了PHP中Result::getTable方法的典型用法代碼示例。如果您正苦於以下問題:PHP Result::getTable方法的具體用法?PHP Result::getTable怎麽用?PHP Result::getTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Result
的用法示例。
在下文中一共展示了Result::getTable方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
/**
* Constructor
* Use $db->createResult( $parent, $name ) instead
*
* @param Database|Result|Row $parent
* @param string $name
*/
function __construct($parent, $name)
{
if ($parent instanceof Database) {
// basic result
$this->db = $parent;
$this->table = $this->db->getAlias($name);
} else {
// Row or Result
// result referenced to parent
$this->parent_ = $parent;
$this->db = $parent->getDatabase();
// determine type of reference based on conventions and user hints
$fullName = $name;
$name = preg_replace('/List$/', '', $fullName);
$this->table = $this->db->getAlias($name);
$this->single = $name === $fullName;
if ($this->single) {
$this->key = $this->db->getPrimary($this->getTable());
$this->parentKey = $this->db->getReference($parent->getTable(), $name);
} else {
$this->key = $this->db->getBackReference($parent->getTable(), $name);
$this->parentKey = $this->db->getPrimary($parent->getTable());
}
}
}
示例2: via
/**
* Create a back reference
*
* @param $key
*
* @return $this
*
* @since 1.0.0
*/
public function via($key)
{
if ($this->parent instanceof DatabaseTable) {
$this->db->schema()->setReference($this->parent->getTable(), $this->table, $key);
}
return $this;
}