本文整理匯總了PHP中DB_DataObject::getLink方法的典型用法代碼示例。如果您正苦於以下問題:PHP DB_DataObject::getLink方法的具體用法?PHP DB_DataObject::getLink怎麽用?PHP DB_DataObject::getLink使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DB_DataObject
的用法示例。
在下文中一共展示了DB_DataObject::getLink方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getLink
/**
* Use ObjectRegistry
*/
public function getLink($row, $table = null, $link = false)
{
// return parent::getLink($row,$table,$link);
if ($table === null) {
$links = $this->links();
if (is_array($links)) {
if ($links[$row]) {
list($table, $link) = explode(':', $links[$row]);
if ($p = strpos($row, ".")) {
$row = substr($row, 0, $p);
}
return $this->getLink($row, $table, $link);
}
// $this->raiseError(
// "getLink: $row is not defined as a link (normally this is ok)",
// DB_DATAOBJECT_ERROR_NODATA);
$r = false;
return $r;
// technically a possible error condition?
}
// use the old _ method - this shouldnt happen if called via getLinks()
if (!($p = strpos($row, '_'))) {
$r = null;
return $r;
}
$table = substr($row, 0, $p);
return $this->getLink($row, $table);
}
if (!isset($this->{$row})) {
// $this->raiseError("getLink: row not set $row", DB_DATAOBJECT_ERROR_NODATA);
return false;
}
if ($obj = DB_DataObject_Pluggable::retreiveFromRegistry($table, $this->{$row})) {
return $obj;
}
$obj = parent::getLink($row, $table, $link);
if (is_object($obj)) {
DB_DataObject_Pluggable::storeToRegistry($obj);
}
return $obj;
}