AtkNode

From Achievo/ATK Wiki

Jump to: navigation, search

Classname: atkNode

API docs

List of other documented ATK classes

Contents

Description

The atkNode class is the single most important class in the ATK framework. A 'node' can be considered an 'entity' or a representation of a database table. Developing applications in ATK means developing nodes, which are classes that are derived from atkNode.

Examples

Here is an example of a typical node:

  class employee extends atkNode
  {
    function __construct()
    {
      parent::__construct("employee");
 
      $this->add(new atkAttribute("id", AF_AUTOKEY));
      $this->add(new atkAttribute("name", AF_SEARCHABLE));
      
      $this->setTable("employee");
    }
  }

Relevant howto's

Relevant documentation

Criticism

One of the critiques of the current implementation of the atkNode is that business logic (AF_OBLIGATORY, overrides etc.) and view parameters (AF_SEARCHABLE, AF_HIDE_EDIT etc.) are mixed. The rationale behind this is that a node not only defines the data structure and business logic, but also the way it should be handled in a CRUD environment. Since this is ATK's focus, this is relatively OK. There are some thoughts about Splitting view and business logic even more, but the disadvantage would be that in many cases, this would lead to extra code, which would be in conflict with the Code minimization philosophy.

Personal tools
Navigation