To define new model, you just need to define these 2 classes and put them to include path, and set $_key, $_table variables to table class. That is all. After that, you can automatically run different operations on these classes. For example:

Am_Record_WithData, Am_Table_WithData

To store additional and optional data for table records, we have defined special class and routines. If table and record subclassed from .._WithTable parents, there are special functions available. Quick samples:

$user = Am_Di::getInstance()->userTable->findFirstByEmail('xx@example.com');
$user->data()->set('xx', 'XX');
$user->update(); // updates user record and related "data()" records or ...
$user->data()->update() // updates only "data()" records
// this will create a record in ?_data table with name='xx' and value='XX' and linked to user table record with given id
unset($user);
$user = Am_Di::getInstance()->userTable->findFirstByEmail('xx@example.com');
echo $user->data()->get('xx'); // will output "XX"