The new OOP structure for version 2.7.0
Registered by
Greg
The new version 2.7.0 introduces a new Object Oriented structure: the starting code is now inside an instance of the PHPDS class. Eventually all globals will disappear.
Blueprint information
Related branches
Related bugs
Sprints
Whiteboard
The new structure is a follow:
- a main instance of PHPDS is at the center
- each core class are represented as fields of the main PHPDS instance
- a generic mecanism allows access to all authorized fields using my_...()
for example, a method of class core can access the template:
class core {
...
function foo()
{
$tpl = $this->
}
}
The scripts are executed inside the template scope, so $this is the template, and the other core objects can be fetched similarily:
$db = $this->my_db();
SOON NO GLOBALS WILL BE AVAILABLE ANYMORE
(?)