title: Holding information about table fields for a class
body: <p>My application has many classes at this point. I want to save a bunch of work by defining information about the fields/properties once, and then use that everywhere else for inserting, updating, deleting and even logging data.</p>
  
  <p>Take a look at this code:</p>
  
  <pre><code>protected $_visible_array = array(0 =&gt; 'No', 1 =&gt; 'Yes');
  
  protected $_type_array = array(1 =&gt; 'Small', 2 =&gt; 'Medium', 3 =&gt; 'Large');
  
  public function field_array() {
      $array['visible'] = info_array('cmp_visible', 'int', 'Visible', $_visible_array);
      $array['type'] = info_array('cmp_type', 'int', 'Type', $_type_array);
      $array['name'] = info_array('cmp_name', 'string', 'Name');
      $array['desc'] = info_array('cmp_desc', 'string', 'Description');
      return $array;
      }
  </code></pre>
  
  <p>My info_array function basically creates an array from the 4 parameters with the indexes 'column', 'type', 'label', 'options' so that I can get these values easily later on.</p>
  
  <p>The first question I have is if it is possible to have something like:</p>
  
  <pre><code>protected $_options['visible] = array(0 =&gt; 'No', 1 =&gt; 'Yes');
  </code></pre>
  
  <p>This way I wouldn't have to pass in that 4th parameter to the info_array function as I would be able to access this array using the "visible" index
  The problem is that I get PHP errors when trying this, not sure why...</p>
  
  <p>I currently have get methods for all my properties, but I was wondering if having something like the following is okay:</p>
  
  <pre><code>    public function get($field) {
      return $this-&gt;$field;
      }   
  </code></pre>
  
  <p>I want to be able to use the index from my field_array to get the value of that property.</p>