summaryrefslogtreecommitdiffstats
path: root/Bugzilla/BugUrl.pm
diff options
context:
space:
mode:
authorTiago Mello <timello@gmail.com>2011-02-11 02:31:28 +0100
committerTiago Mello <timello@gmail.com>2011-02-11 02:31:28 +0100
commitf0b6242097e487198de559d39d4169a2a0a4d8e7 (patch)
tree8e6dce90308e188c2d3656859fa319b2b8544221 /Bugzilla/BugUrl.pm
parenta744c531a46bdd18aed3cc89ed0770a791d27475 (diff)
downloadbugzilla-f0b6242097e487198de559d39d4169a2a0a4d8e7.tar.gz
bugzilla-f0b6242097e487198de559d39d4169a2a0a4d8e7.tar.xz
Bug 620827: Refactor remove see also to use remove_from_db instead.
r/a=mkanat
Diffstat (limited to 'Bugzilla/BugUrl.pm')
-rw-r--r--Bugzilla/BugUrl.pm27
1 files changed, 27 insertions, 0 deletions
diff --git a/Bugzilla/BugUrl.pm b/Bugzilla/BugUrl.pm
index 521ee8193..f4f0e410b 100644
--- a/Bugzilla/BugUrl.pm
+++ b/Bugzilla/BugUrl.pm
@@ -40,6 +40,7 @@ use constant DB_COLUMNS => qw(
id
bug_id
value
+ class
);
# This must be strings with the names of the validations,
@@ -48,6 +49,7 @@ use constant DB_COLUMNS => qw(
use constant VALIDATORS => {
value => '_check_value',
bug_id => '_check_bug_id',
+ class => \&_check_class,
};
# This is the order we go through all of subclasses and
@@ -62,6 +64,13 @@ use constant SUB_CLASSES => qw(
);
###############################
+#### Accessors ######
+###############################
+
+sub class { return $_[0]->{class} }
+sub bug_id { return $_[0]->{bug_id} }
+
+###############################
#### Methods ####
###############################
@@ -92,6 +101,18 @@ sub new {
return $class->SUPER::new(@_);
}
+sub _do_list_select {
+ my $class = shift;
+ my $objects = $class->SUPER::_do_list_select(@_);
+
+ foreach my $object (@$objects) {
+ eval "use " . $object->class; die $@ if $@;
+ bless $object, $object->class;
+ }
+
+ return $objects
+}
+
# This is an abstract method. It must be overridden
# in every subclass.
sub should_handle {
@@ -115,6 +136,12 @@ sub class_for {
reason => 'show_bug' });
}
+sub _check_class {
+ my ($class, $subclass) = @_;
+ eval "use $subclass"; die $@ if $@;
+ return $subclass;
+}
+
sub _check_bug_id {
my ($class, $bug_id) = @_;