Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-updates > by-pkgid > 3b735b44c1e188a44c40f81bded6b6df > files > 825

bugzilla-4.4.12-1.mga5.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>
Bugzilla::Field::Choice</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <link rel="stylesheet" title="style" type="text/css" href="../.././../../../style.css" media="all" >

</head>
  <body id="pod">
<p class="backlinktop"><b><a name="___top" href="../../index.html" accesskey="1" title="All Documents">&lt;&lt;</a></b></p>
<h1>Bugzilla::Field::Choice</h1>
<div class='indexgroup'>
<ul   class='indexList indexList1'>
  <li class='indexItem indexItem1'><a href='#NAME'>NAME</a>
  <li class='indexItem indexItem1'><a href='#SYNOPSIS'>SYNOPSIS</a>
  <li class='indexItem indexItem1'><a href='#DESCRIPTION'>DESCRIPTION</a>
  <li class='indexItem indexItem1'><a href='#METHODS'>METHODS</a>
  <ul   class='indexList indexList2'>
    <li class='indexItem indexItem2'><a href='#Class_Factory'>Class Factory</a>
    <li class='indexItem indexItem2'><a href='#Mutators'>Mutators</a>
  </ul>
</ul>
</div>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="NAME"
>NAME</a></h1>

<p>Bugzilla::Field::Choice - A legal value for a &#60;select&#62;-type field.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="SYNOPSIS"
>SYNOPSIS</a></h1>

<pre  class="code"> my $field = new Bugzilla::Field({name =&#62; &#39;bug_status&#39;});

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

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

<h1><a class='u' href='#___top' title='click to go to top of document'
name="DESCRIPTION"
>DESCRIPTION</a></h1>

<p>This is an implementation of <a href="../../Bugzilla/Object.html" class="podlinkpod"
>Bugzilla::Object</a>, but with a twist. You can&#39;t call any class methods (such as <code  class="code">new</code>, <code  class="code">create</code>, etc.) directly on <code  class="code">Bugzilla::Field::Choice</code> itself. Instead, you have to call <code  class="code">Bugzilla::Field::Choice-&#62;type($field)</code> to get the class you&#39;re going to instantiate, and then you call the methods on that.</p>

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

<p>See the <a href="#SYNOPSIS" class="podlinkpod"
>&#34;SYNOPSIS&#34;</a> for examples of how this works.</p>

<p>This class implements <a href="../../Bugzilla/Field/ChoiceInterface.html" class="podlinkpod"
>Bugzilla::Field::ChoiceInterface</a>, and so all methods of that class are also available here.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="METHODS"
>METHODS</a></h1>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="Class_Factory"
>Class Factory</a></h2>

<p>In object-oriented design, a &#34;class factory&#34; is a method that picks and returns the right class for you, based on an argument that you pass.</p>

<dl>
<dt><a name="type"
><code  class="code">type</code></a></dt>

<dd>
<p>Takes a single argument, which is either the name of a field from the <code  class="code">fielddefs</code> table, or a <a href="../../Bugzilla/Field.html" class="podlinkpod"
>Bugzilla::Field</a> object representing a field.</p>

<p>Returns an appropriate subclass of <code  class="code">Bugzilla::Field::Choice</code> that you can now call class methods on (like <code  class="code">new</code>, <code  class="code">create</code>, <code  class="code">match</code>, etc.)</p>

<p><b>NOTE</b>: YOU CANNOT CALL CLASS METHODS ON <code  class="code">Bugzilla::Field::Choice</code>. You must call <code  class="code">type</code> to get a class you can call methods on.</p>
</dd>
</dl>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="Mutators"
>Mutators</a></h2>

<p>This class implements mutators for all of the settable accessors in <a href="../../Bugzilla/Field/ChoiceInterface.html" class="podlinkpod"
>Bugzilla::Field::ChoiceInterface</a>.</p>
<p class="backlinkbottom"><b><a name="___bottom" href="../../index.html" title="All Documents">&lt;&lt;</a></b></p>

<!-- end doc -->

</body></html>