The Objekt2 class will become the basis for all of our objekts in the future. It presents a new way of handling the data in the database from the Objekt class and allows us to have objekts with more complex relationships to tables than just one row per objekt. It relies highly on the TableAccessor class - See the TableAccessor doc.

Any Objekt2 class object should be able to be read/saved with or without going through the UI (a big difference from the Objekt class which is UI only). We accomplish this, and backwards compatibility with code used to the Objekt class, by having the InputObjects store their information in the array and then having the TableAccessors run through the array creating the SQL statement(s) needed for insert or update. The InputObject2 class (yet to be implemented) will store data directly to the Objekt2 data array and allow for more complex input types with multiple pieces of data.

If you do not need to show the user a UI, you can simply read the object in, change any items in the data array, and then save the data out.

The Objekt2 class has an array of accessors and at read and save time, those TableAccessors are called.

The __construct() function of an Objekt2 objekt needs to create the table accessors it uses. Here's an example from the aupageBase objekt (which is used by article)

 function __construct()
 {
  global $database;
  
  $this->rgAccessors['objekt_objekt'] = new Objekt_Objekt_Accessor($database); 
  $this->rgAccessors['objekt_groups'] = new Objekt_Groups_Accessor($database);
  $this->rgAccessors['objekt_editors'] = new Objekt_Editors_Accessor($database);
 }
 

Note how each accessor is added to the array with it's table name as the key.

Also important for the Objekt2 class is the $rgDataItems array. This lists for each table, any items that belong in a data "blob" to be distinguished from items that belong in table columns.

Looking at the article objekt

 var $rgDataItems = array(
      'objekt_objekt' => array(
           'summary',
           'maintext',
           ),
      );