[Rt-commit] rt branch, 3.999-trunk, updated. 26c8851a4f3ffe08488670fee3513af3db5075f1

sartak at bestpractical.com sartak at bestpractical.com
Thu Dec 3 06:13:47 EST 2009


The branch, 3.999-trunk has been updated
       via  26c8851a4f3ffe08488670fee3513af3db5075f1 (commit)
      from  8a44df1018b6dac7921fa22654b6014f132eed52 (commit)

Summary of changes:
 lib/RT/Model/Queue.pm |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 26c8851a4f3ffe08488670fee3513af3db5075f1
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Dec 3 06:13:32 2009 -0500

    Permit called RT::Model::Queue->load as a class method

diff --git a/lib/RT/Model/Queue.pm b/lib/RT/Model/Queue.pm
index 0c1e40f..a64cd5a 100755
--- a/lib/RT/Model/Queue.pm
+++ b/lib/RT/Model/Queue.pm
@@ -293,6 +293,9 @@ Takes a boolean.
 =head2 load
 
 Takes either a numerical id or a textual name and loads the specified queue.
+Returns the queue's ID.
+
+When called as a class method, instantiates a new queue object and returns it.
 
 =cut
 
@@ -303,6 +306,13 @@ sub load {
         return (undef);
     }
 
+    # when called as a class method, load up a new object and return it
+    if (!ref($self)) {
+        my $obj = $self->new;
+        $obj->load($identifier);
+        return $obj;
+    }
+
     if ( $identifier =~ /^(\d+)$/ ) {
         $self->load_by_cols( id => $identifier );
     } else {

-----------------------------------------------------------------------


More information about the Rt-commit mailing list