Skip to content

0.2 - Implement Models and Persistence

Compare
Choose a tag to compare
@romaninsh romaninsh released this 27 Jun 01:09
· 2166 commits to develop since this release

This is the first usable version of Agile Data.

You should be able to define your models:

class Model_User extends \atk4\data\Model {
    protected $table = 'user';
    function init() {
        parent::init();
        $this->addField('name');
        $this->addField('surname');
    }

and then use them:

$m = new Model_User($db);

$m->load(1);
$m['name'] = 'John';
$m->save();

This implementation contains:

  • Active Record (array access) implementation
  • Driver implementation Array and SQL (on top of DSQL)
  • Record field type bi-directional mapping (boolean, date, enum, json)
  • Mechanic for tracking field changes (original values, dirty etc)
  • Ability to move field from one persistence driver to another