internal > Doc

refactor Fields / #2080

Summary

open
Sep 19, 2006
Sep 19, 2006 / pixtur
Oct 16, 2006 / pixtur
 

Attached files

No files uploaded
In combination with refactor Filters we should refactor the usage of fields in DbItem.

Problems:

  • double usage of field-lists:
    • fields - assoc. array of field_name => Field object (reference to global array like $g_task_fields)
    • field_states - assoc array of field_name => status actually meant to lazy loading from database. Now only used for checking if a Item has a field
  • global variables like $g_task_fields
  • weird initialization of fields (must be init outside of Class definiation because of translation issues)
  • Field-Definitions are not commonly available in static functions like Task::query() which makes them harder to be used for building SQL-queries
  • rendering and parsing of Forms is current obscur (scattered over db_item.inc.php, render_fields.inc.php and render_form.inc.php).

Changes:

  • completely remove DbItem::field_states
  • add static function DbItem::init() as factory method after class definition (e.g. just behind Class Task { ... } )
    • move field definition into this function
  • make DbItem::fields a static member
  • assemble all field-related functions to new sourcefile: db/db_fields.inc.php



also see:

Comment / Update