本文整理汇总了PHP中Datamodel::getInstanceByTableNum方法的典型用法代码示例。如果您正苦于以下问题:PHP Datamodel::getInstanceByTableNum方法的具体用法?PHP Datamodel::getInstanceByTableNum怎么用?PHP Datamodel::getInstanceByTableNum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datamodel
的用法示例。
在下文中一共展示了Datamodel::getInstanceByTableNum方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRelationshipTypesForParentAsDOM
private function getRelationshipTypesForParentAsDOM($pn_parent_id)
{
$t_list = new ca_lists();
$vo_types = $this->opo_dom->createElement("types");
$qr_types = $this->opo_db->query("SELECT * FROM ca_relationship_types WHERE parent_id=?", $pn_parent_id);
if (!$qr_types->numRows()) {
return false;
}
while ($qr_types->nextRow()) {
$vo_type = $this->opo_dom->createElement("type");
if (preg_match("/root\\_for\\_[0-9]{1,3}/", $qr_types->get("type_code"))) {
// ignore legacy root records
continue;
}
$vo_type->setAttribute("code", $this->makeIDNO($qr_types->get("type_code")));
$vo_type->setAttribute("default", $qr_types->get("is_default"));
$vo_labels = $this->opo_dom->createElement("labels");
$qr_type_labels = $this->opo_db->query("SELECT * FROM ca_relationship_type_labels WHERE type_id=?", $qr_types->get("type_id"));
while ($qr_type_labels->nextRow()) {
$vo_label = $this->opo_dom->createElement("label");
$vo_label->setAttribute("locale", $this->opt_locale->localeIDToCode($qr_type_labels->get("locale_id")));
$vo_label->appendChild($this->opo_dom->createElement("typename", caEscapeForXML($qr_type_labels->get("typename"))));
$vo_label->appendChild($this->opo_dom->createElement("typename_reverse", caEscapeForXML($qr_type_labels->get("typename_reverse"))));
$vo_labels->appendChild($vo_label);
}
$vo_type->appendChild($vo_labels);
// restrictions (left side)
/** @var BaseRelationshipModel $t_instance */
$t_instance = $this->opo_dm->getInstanceByTableNum($qr_types->get("table_num"));
if ($qr_types->get("sub_type_left_id")) {
/** @var BaseModelWithAttributes $t_left_instance */
$vs_left_table = $t_instance->getLeftTableName();
$t_left_instance = $this->opo_dm->getInstanceByTableNum($vs_left_table);
$vs_type_code = $t_left_instance->getTypeListCode();
$va_item = $t_list->getItemFromListByItemID($vs_type_code, $qr_types->get("sub_type_left_id"));
$vo_type->appendChild($this->opo_dom->createElement("subTypeLeft", $va_item["idno"]));
}
// restrictions (right side)
if ($qr_types->get("sub_type_right_id")) {
/** @var BaseModelWithAttributes $t_right_instance */
$vs_right_table = $t_instance->getRightTableName();
$t_right_instance = $this->opo_dm->getInstanceByTableNum($vs_right_table);
$vs_type_code = $t_right_instance->getTypeListCode();
$va_item = $t_list->getItemFromListByItemID($vs_type_code, $qr_types->get("sub_type_right_id"));
$vo_type->appendChild($this->opo_dom->createElement("subTypeRight", $va_item["idno"]));
}
// subtypes
if ($vo_subtypes = $this->getRelationshipTypesForParentAsDOM($qr_types->get("type_id"))) {
$vo_types->appendChild($vo_subtypes);
}
$vo_types->appendChild($vo_type);
}
return $vo_types;
}