Newsletterdeveloper's documentation

dbo_session Class Reference
[DBO Core API]

DBO session. More...

List of all members.

Public Member Functions

 get_object ($type, $id)
 Get existing object from the session.
 put_object (dbo $obj)
 Put existing or new object into session.
 get_named_object ($name)
 Get object that is associated with given name.
 set_object_name ($obj, $name)
 Associate name with some object.
 check ()
 Check validity of DBO session objects.
 dump ($invalid_only=false, $level=1)
 Dump DBO objects to string.
 commit ()
 Commit session to the database.

Public Attributes

 $context
 $message
 [string|null] Commit error message.

Private Attributes

 $objects = array()
 $new_objects = array()
 $named_objects = array()


Detailed Description

DBO session.

DBO session is used to keep track of DBO objects that are retrieved from database or created by the user. It is also used to commit changes to the database.

Use dbo_manager to store/load DBO session to/from PHP session.

Also to be able to get some particular object from DBO session that is loaded from PHP session, you have to name object before storing session.

Session may also have context associated with it, which can be used to modify behaviour of DBOs stored in the session.


Member Function Documentation

dbo_session::check (  ) 

Check validity of DBO session objects.

You may use this multiple times for same session. After check you may want to browse through all obejcts to collect error messages.

Returns:
[boolean] True if ok, false otherwise.

Referenced by commit().

dbo_session::commit (  ) 

Commit session to the database.

You may use this multiple times for same session.

Returns:
[boolean] True if ok, false otherwise.

References $objects, check(), and put_object().

dbo_session::dump ( invalid_only = false,
level = 1 
)

Dump DBO objects to string.

Parameters:
invalid_only [boolean] Dump only invalid DBOs.
level [int] Dump depth.
Returns:
[string] DBO objects.

dbo_session::get_named_object ( name  ) 

Get object that is associated with given name.

Parameters:
name [string] Name.
Returns:
[dbo|null] DBO instance or null.

dbo_session::get_object ( type,
id 
)

Get existing object from the session.

This is used internally by dbo::_get().

Parameters:
type [string] DBO object name.
id [int] DBO object id.
Returns:
[dbo|null] DBO object instance or null if it is not in session yet.

dbo_session::put_object ( dbo obj  ) 

Put existing or new object into session.

Parameters:
obj [dbo] Any DBO instance.
Returns:
[dbo] Same object.

Referenced by commit().

dbo_session::set_object_name ( obj,
name 
)

Associate name with some object.

Parameters:
obj [dbo] Any DBO instance.
name [string] Name.


Member Data Documentation

dbo_session::$context

dbo_session::$message

[string|null] Commit error message.

dbo_session::$named_objects = array() [private]

dbo_session::$new_objects = array() [private]

dbo_session::$objects = array() [private]

Referenced by commit().


The documentation for this class was generated from the following file:
Documentation for Newsletter, Tue Nov 11 07:50:02 2008.