Migrating from Agile Toolkit 4.1.3 to 4.2 master branch. Notes.

by Janis Volbergs, June 11th,2012

It has been a while since Agile Toolkit 4.2 version was introduced. I was involved in testing it and creating some compatibility patches. It feels that now 4.2 is stable enough to move older products to this newer, much more enhanced version of agile toolkit. This time, I will take notes, while migrating to ease up migration for other developers.

Updating Agile Toolkit libraries

All right. Let’s start with getting atk4 and addons updated. To do so, it’s really simple:

cd atk4

git checkout master

git pull

and

cd atk4-addons

git checkout master

git pull

Fixing authorization

Now, we have the latest 4.2 version installed. Let us proceed with compatibility fixes. First thing I noticed is following:

Fatal error: Call to a member function loaded() on a non-object in /var/www/gtd42.bdsa.biz/htdocs/atk4/lib/Auth/Basic.php on line 242

In 4.2 we have radically redesigned authorization class, which supports fancy add-ons. So my old code was like:

4.2 comes with new Model implementation

With this sorted, I get next error:

Fatal error: Access level to Model_MVCTable::$id must be public (as in class Model) in /var/www/gtd42.bdsa.biz/htdocs/atk4-addons/mvc/Model/MVCTable.php on line 9

This is because I had my own Model_Table model implementation that extends Model_MVCTable. The latter is 4.1 implementation of models, and we definitely want to use 4.2 Model instead. However, Model_Table is no more user re-definable, thus, whatever extra features we have in the custom implementation, we can move those away to Controllers and use following technique:

$this->add(“Controller_ModelEnhancer”)

So, here is the original Model

<?php
class Model_Table extends Model_MVCTable {

function getValues(){

$r = $this->getRows();
$out = array("-");
foreach ($r as $row){

$out[$row["id"]] = $row["name"];

}
return $out;

}

}

We remove this custom model class, and create a controller class Controller/ModelEnhancer.php

4. filestore integration

Outro

This covers brief outlook of changes that you will have to implement to move to latest Agile Toolkit version
As you can see, most are rather trivial and will not take much time. Unless you have many models.
I did not touch upon new form styling - yep, setFormClass(“vertical”) is gone and instead you should use setFormClass(“stacked”).
There are changes in templates, new fields and UI elements. If you had many custom form layouts, those will require some update as well.

Surely, there are other minor issues that you might runinto. There is new implementation of Export addon, OAuth, Social Integration addons - they are more powerful and flexible. Some of the old addons are not ported to 4.2 just yet, so if you relay heavily on addons, there might be some extra work to be done.

Is it worth updating to 4.2 after all? Short answer - definitely. MVC has become integral part of Agile Toolkit and not only it has been written from scratch, but also many new great php features have been applied to even further enhance the development experience.

That then summarizes my notes on 4.2 agile toolkit migration. Good luck with Agile Toolkit and see you around!

P.s. Follow @AmbientTech_lv to get updates about new blog entries about Agile Toolkit