NAME
Foorum::ResultSet::Forum - Forum object
FUNCTION
- get
-
$schema->resultset('Forum')->get( $forum_id ); $c->model('DBIC::User')->get( $forum_id ); $c->model('DBIC::User')->get( $forum_code );
get() do not query database directly, it try to get from cache, if not exists, get from database and set a cache. (we may call it $forum_obj below)
{ forum_id => 1, forum_code => 'FoorumTest', # other columns in database forum_url => '/forum/ForumTest', settings => { can_post_threads => 'Y', can_post_replies => 'N', can_post_polls => 'Y' } }
settings in the hash is from Foorum::ResultSet::ForumSettings get_basic.
return $HASHREF
- update_forum($forum_id, $update)
-
$schema->resultset('Forum')->update_forum( $forum_id, { last_post_id => $topic_id } ); $c->model('DBIC::Forum')->update_forum( $forum_id, { total_members => $members } );
inside, it calls search( { forum_id => $forum_id } )->update($update) and remove cache in get
- remove_forum($forum_id)
-
$schema->resultset('Forum')->remove_forum( $forum_id );
delete all things belong to $forum, BE CAREFUL, it's un-recoverable.
- merge_forums($info)
-
$schema->resultset('Forum')->merge_forums( { from => $old_forum_id, to => $new_forum_id } );
move things belong to $old_forum_id to $new_fourm_id
- validate_forum_code($forum_code)
-
$schema->resultset('Forum')->validate_forum_code( $forum_code ); $c->model('DBIC::Forum')->validate_forum_code( $forum_code );
validate $forum_code, return nothing means OK while return $str is an error_code like 'LENGTH', 'HAS_RESERVED' and others.
AUTHOR
Fayland Lam <fayland at gmail.com>