What's in store for 0.6

Version 0.6 brings significant architectural change to Modern Merchant. It is a release for PHP developers. Look for an alpha release in the next couple months.

Read more to learn about the new enhancements.

Here are some of the feature of interest for developers:

  • Moved completely to a plugin-based architecture.
  • PEAR DB has been eliminated in favor of a lighter database abstraction layer.
  • Smarty has been eliminated.
  • MVC is smaller, lighter, more powerful and easier to use.
  • Tighter integration between Controller and View, Controller and Model
  • A lot of dead code has been eliminated.

A typical plugin directory looks like this:

  • myplugin/
    • Plugin.php
    • Controller.php
    • MyModel.php
    • Test.php
    • templates/
      • list.php
      • edit.php

To demonstrate the improvements in MVC, the product controller's "edit" action now has only one line of code:

function runEditAction()
{
    $this->product = $this->requireProduct($this->req('product'));
}

The product's "update" action has only 9 lines of code:

function runUpdateAction()
{
    $this->product = $this->dao->fetch($this->getRequiredParam('product_id'));
    $this->product->setValues($this->req('product'));
    if ($errors = $this->product->validateForSave()) {
        $this->addWarnings($errors);
        return $this->goToView('edit');
    }
    $this->product->save();
    $this->addNotice("Product successfully updated.");
    return $this->goToRedirect($this->getListOrSearch());
}

A great deal of what I learned in Ruby on Rails has been sprinkled in to Modern Merchant, making it significantly more simple and easier to develop.