[Rt-commit] rt branch, 4.2/record-class-on-collection, created. rt-4.1.13-27-g0c23acb
Thomas Sibley
trs at bestpractical.com
Thu Jun 27 19:39:41 EDT 2013
The branch, 4.2/record-class-on-collection has been created
at 0c23acb1a6bfcb795d9560f46e99dd521d82bb71 (commit)
- Log -----------------------------------------------------------------
commit 0c23acb1a6bfcb795d9560f46e99dd521d82bb71
Author: Thomas Sibley <trs at bestpractical.com>
Date: Thu Jun 27 16:37:30 2013 -0700
Refactor and move RecordClass into RT::SearchBuilder
_SingularClass provides the same functionality, but we use the term
RecordClass elsewhere (RT::SharedSetting and subclasses and
RT::SearchBuilder::AddAndSort).
RecordClass is easier to remember and not private.
diff --git a/lib/RT/SearchBuilder.pm b/lib/RT/SearchBuilder.pm
index f9894e9..400f0ba 100644
--- a/lib/RT/SearchBuilder.pm
+++ b/lib/RT/SearchBuilder.pm
@@ -253,6 +253,17 @@ sub _SingularClass {
return $class;
}
+=head2 RecordClass
+
+Returns class name of records in this collection. This generic implementation
+just strips trailing 's'.
+
+=cut
+
+sub RecordClass {
+ $_[0]->_SingularClass
+}
+
=head2 _CustomFieldJoin
Factor out the Join of custom fields so we can use it for sorting too
diff --git a/lib/RT/SearchBuilder/AddAndSort.pm b/lib/RT/SearchBuilder/AddAndSort.pm
index 3d8ef11..2743ee8 100644
--- a/lib/RT/SearchBuilder/AddAndSort.pm
+++ b/lib/RT/SearchBuilder/AddAndSort.pm
@@ -84,19 +84,6 @@ sub _Init {
return $self->SUPER::_Init(@_);
}
-=head2 RecordClass
-
-Returns class name of records in this collection. This generic implementation
-just strips trailing 's'.
-
-=cut
-
-sub RecordClass {
- my $class = ref($_[0]) || $_[0];
- $class =~ s/s$// or return undef;
- return $class;
-}
-
=head2 LimitToObjectId
Takes id of an object and limits collection.
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list