Hi,
the latter option (using long array and Utils_RecordBrowserCommon::install_new_recordset) is the procedure way, that was designed at first and can be used nowadays. The first one (using RBO_Recordset) is the extension to make it easier and better use IDE capabilities of autocompletion. It still uses old methods as a backend, however it may simplify a lot of things. I recommend to use this method.
Yes - class_name() method returns name of a class that represents single record. You don't have to override this method, unless you want add some logic to the record. It will use RBO_Record class. Naming convention - autoloader compatible.
If your module uses more than one recordset, then I recommend to use meaningful names (depends on your habits) - for instance in DirName_Mod_Car for record and DirName_Mod_Cars for recordset. However the difference is too little and it it's error prone, so something like DirName_Mod_CarRecord, DirName_Mod_CarsRS (RS - RecordSet). Of course files names have to reflect class name.
RecordBrowser does loose coupling between records. It means that they are not refenced in the database.
You have to create your own recordset, then refer like in your example, but use recordset object, or its table_name.
For the fields() method you have to supply field object or field name, not it's ID. It may be confusing but, the best solution for this is to create a bunch of methods in the Recordset for creating fields
// First recordset
class XX {
public function table_name() { return 'xx'; }
public function field_title() {
$f = new RBO_Field_Text(_M("Title"));
$f->set_required();
return $f;
}
public function fields() {
$fields = array();
$fields[] = $this->field_title();
return $fields;
}
}
// Second recordset
... code ommited
$Select = new RBO_Field_Select('Select');
$first_rs = new XX();
$Select->from($first_rs)->fields($first_rs->field_title())->set_visible();
$fields[] = $Select;
It's the best method to use field name just once.
But of course you could do this like that
$Select = new RBO_Field_Select('Select');
$Select->from('xx')->fields('Title')->set_visible(); // not 'title'
$fields[] = $Select;
Regards,
Adam