本文整理汇总了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;
}