Migration Guide

Jordan Lev edited this page May 1, 2014 · 1 revision

Use Page::getCurrentPage() instead of global $c

Before 5.7, you could retrieve the "current page" variable using either Page::getCurrentPage() or global $c. As of 5.7, however, you must only use Page::getCurrentPage(). So if your old code looked like this:

global $c;
echo $c->getCollectionName();

...you should change it to this:

$c = Page::getCurrentPage();
echo $c->getCollectionName();

Use PHP Namespacing instead of Loader functions

Concrete5.7 introduces the use of php namespaces in lieu of the various Loader::xxxxx() functions (e.g. Loader::model(), Loader::library(), etc.). See http://andrewembler.com/posts/concrete5-5-7-add-on-development-part-1/ for more info.

Move dashboard controller files into new controllers/single_page/ subdirectory

Dashboard page controller files used to be structured like so:

controllers
|- dashboard
   |- reports
      |- my_custom_dashboard_page.php

...but now you must add a new single_page directory underneath the top-level controllers directory:

controllers
|- single_page
   |- dashboard
      |- reports
         |- my_custom_dashboard_page.php

See http://andrewembler.com/posts/concrete5-5-7-add-on-development-part-1/ for more details.

Use Bootstrap 3 Styles for Block Add/Edit Dialogs

See "Block UI" section of http://andrewembler.com/posts/concrete5-57-add-on-development-part-2/

Use Bootstrap 3 Styles for Dashboard Pages

See "Confirm Signup Single Page" and "Dashboard Reports Page" sections of http://andrewembler.com/posts/concrete5-57-add-on-development-part-2/

Use Doctrine DBAL instead of ADODB

ADODB is being replaced by Doctrine DBAL. Most of the ADODB functions will continue to work (see https://github.com/concrete5/concrete5-5.7.0/blob/master/web/concrete/core/Database/Connection.php), but some cannot be translated automatically so you will need to manually modify any of your code that uses these:

  • AutoExecute: Doctrine DBAL has similar functionality, but instead of being combined into one function (like it was with ADODB), there are two separate functions: insert() and update(). Note that for the update() function, you must pass in an array of field => value pairs for the 3rd argument, as opposed to ADODB's AutoExecute function which had you passing in a portion of a SQL WHERE clause. For example, if your old code looked like this:

      $table = 'MyThings';
      $data = array(
          'name' => 'John Smith',
          'email' => 'john@example.com',
          'phone' => '555-1212',
      );
      $db->AutoExecute($table, $data, 'UPDATE', 'id = 3');
    

...you should change it to this:

    $table = 'MyThings';
    $data = array(
        'name' => 'John Smith',
        'email' => 'john@example.com',
        'phone' => '555-1212',
    );
    $db->update($table, $data, array('id' => 3);

Use Doctrine ORM instead of ADODB ActiveRecord

TODO

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.