What is coming up or was just introduced in Stable and Development version of Agile Toolkit/?> download, development version, stable version, changes, updates, changelog, recent changes/?>
Version 4.2 release is aimed at making Agile Toolkit cleaner, more documented, more flexible and scalable. Your web software developed with 4.1 can be easily adopted to use with 4.2. This version is highly recommended for new software. You should upgrade to 4.2 if your software is still in it's development phase. For software already deployed with 4.1 we have released the 4.1.4 version.
To get into 4.2 quickly with minimum amount of changes, we've created a "Compatibility" layer. To activate it, you need to add the following line to your Application's init() code (preferably right after parent::init())
$this->requires('atk','4.1.4'); /?>With this you will be able to switch between 4.1 and 4.2 easily.
Most of the functionality in 4.2 is syntactically compatible with 4.1, although some things will require changes. The 4.1.4 will attempt to provide a common syntax which will help switching between version easier.
If you are upgrading, read this document carefully. Features labeled "IMPORTANT" require change of your code.
DSQL, Models, and Database access classes have been fully rewritten. DSQL is now PDO-compatible and will work with non-MySQL databases. It has been tested with Sqlite and PostreSQL. The new implementation is compatible, but also more powerful, cleaner and flexible. New features:
The implementation of models in 4.1 have been considered an add-on due to poor quality of the code. In 4.2 model code has been completely rewritten and the new version is much more powerful and much better integrated. Models have also been divided into two classes: Relational models and non-relational. You can extend non-relational models to use with no-SQL databases by adding Data Controllers. (note: MemCached data controller is not included with Agile Toolkit)
$book = $this->add('Model_Book') ->setSource('MemCached','book') ->load($_GET['id']); $book['views']++; $book->save(); /?>Non-relational models represent most of the no-sql storage options. They maintain the "ID"=> "hash of fields" relationship, can load, store, delete and add records through appropriate controller. They have nothing to do with SQL. Model represent a classic implementation of active record. Model class implements the following features:
The model field definition object have been rewritten also. It can now participate in query building and even add hooks into the model, so it's much easier now to add custom field types.
See Full documentation of Model, Model class reference.Model_Table class is more powerful than ever. It takes advantage of new field definition classes to implement relations and references. Relation are "joins" between multiple tables and references are "links" between models. This concept is separated very specifically in 4.2. The model implementation in 4.2 is also much more consistent in it's mechanics too.
class Model_Book extends Model_Table { public $table='book'; function init(){ parent::init(); $this->hasOne('Author'); $this->hasMany('Chapter'); $this->addField('name'); $this->addField('gender')->enum(array('M','F')); $this->addField('is_retired')->type('boolean'); $details = $this->join('book_details'); $details->addField('info'); } } /?>While in the above definition Agile Toolkit makes even more assumptions (such as book.author_id exists and book.author needs to be defined as sub-select and show author.name, also that chapter.book_id is set and book.book_details_id exists and points to book_details.id. It also assumes that boolean is represented with 0=false 1=true) ALL of those assumptions can be corrected.
class Model_Book extends Model_Table { public $table='book'; public $title_field='book_name'; public $id_field='isbn'; function init(){ parent::init(); $this->hasOne('Author','book_isbn','first_name'); $this->hasMany('Chapter','book_isbn'); $this->addField('book_name'); $this->addField('gender')->setValueList(array(1=>'M', 2=>'F')); $this->addField('is_retired')->type('boolean')->enum(arary('Y','N')); $details = $this->join('book_details.isbn','isbn'); $details -> addField('details')->rename('book_details'); } } /?>The later declaration solves many problems users of Agile Toolkit 4.1 had in the past. It defines a different ID field for the table and also defines a title field, which is used by other model with "hasOne" reference. Boolean value uses compatible Y/N format and when joining "book_details" table book_details.isbn=book.isbn is used (although 2nd argument could have been ommited). Below is the list of all other features:
See Full documentation of Relational Model, Model_Table class reference.
See Full documentation of Core Objects, AbstractObject class reference.
See Full documentation of Application Classes, API class reference.
See Full documentation of View Class, API class reference.