xo::db::CrClass proc get_instance_from_db (public)

 xo::db::CrClass[i] get_instance_from_db [ -item_id item_id ] \
    [ -revision_id revision_id ] [ -initialize on|off ]

Defined in /var/www/openacs.org/packages/xotcl-core/tcl/cr-procs.tcl

Instantiate the live revision or the specified revision of an CrItem. The XOTcl object is destroyed automatically on cleanup (end of a connection request).

Switches:
-item_id (optional, integer, defaults to "0")
-revision_id (optional, integer, defaults to "0")
-initialize (optional, boolean, defaults to "true")
Returns:
fully qualified object containing the attributes of the CrItem

Testcases:
test_cr_items, create_workflow_with_instance, xowiki_test_cases, link_tests, slot_interactions, path_resolve
Source code:
set object ::[expr {$revision_id ? $revision_id : $item_id}]
if {$object eq "::0"} {
  set msg "get_instance_from_db must be called with either item_id or revision_id different from 0"
  ad_log error $msg
  error $msg
}
if {![::nsf::is object $object]} {
  set object_type [:get_object_type -item_id $item_id -revision_id $revision_id]
  set class [::xo::db::Class object_type_to_class $object_type]
  set object [$class get_instance_from_db -item_id $item_id -revision_id $revision_id -initialize $initialize]
}
return $object
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: