Bugzilla::Field::Choice - A legal value for a <select>-type field.


 my $field = new Bugzilla::Field({name => 'bug_status'});

 my $choice = new Bugzilla::Field::Choice->type($field)->new(1);

 my $choices = Bugzilla::Field::Choice->type($field)->new_from_list([1,2,3]);
 my $choices = Bugzilla::Field::Choice->type($field)->get_all();
 my $choices = Bugzilla::Field::Choice->type($field->match({ sortkey => 10 }); 


This is an implementation of Bugzilla::Object, but with a twist. You can't call any class methods (such as new, create, etc.) directly on Bugzilla::Field::Choice itself. Instead, you have to call Bugzilla::Field::Choice->type($field) to get the class you're going to instantiate, and then you call the methods on that.

We do that because each field has its own database table for its values, so each value type needs its own class.

See the "SYNOPSIS" for examples of how this works.


Class Factory

In object-oriented design, a "class factory" is a method that picks and returns the right class for you, based on an argument that you pass.


Takes a single argument, which is either the name of a field from the fielddefs table, or a Bugzilla::Field object representing a field.

Returns an appropriate subclass of Bugzilla::Field::Choice that you can now call class methods on (like new, create, match, etc.)

NOTE: YOU CANNOT CALL CLASS METHODS ON Bugzilla::Field::Choice. You must call type to get a class you can call methods on.


These are in addition to the standard Bugzilla::Object accessors.


The key that determines the sort order of this item.


The Bugzilla::Field object that this field value belongs to.


Tells you which values in other fields appear (become visible) when this value is set in its field.

Returns a hashref of arrayrefs. The hash keys are the names of fields, and the values are arrays of Bugzilla::Field::Choice objects, representing values that this value controls the visibility of, for that field.