HomeDevCentral

Refactoring: Adding a Controller::load() method
29f471ac7e09Unpublished

Unpublished Commit · Learn More

Repository Importing: This repository is still importing.

Description

Refactoring: Adding a Controller::load() method

[ Previous workflow ]

The run() method initialiazed a new instance of the class, then
called the handleRequest() method.

[ New workflow )

A load() method initialiazes a new instance of the class and
returns it.

This allows to get a controller, and performs actions before to call
handleRequest(), actions not specified in the context or in initialize().

The run() factory method calls load, then handleRequest().

[ Goal ]

The next commit will introduce a ErrorPageController to replace the
procedural.

This controller needs to know the error code to print, but this information
isn't present in the context, and it seems more clear to offer a static
method "show a ... error page" than to add properties to the context.

So we offer the capability, in addition to the Run() mechanism to offer
custom static factory methods in controllers classes.

Details

Provenance
derecksonAuthored on
Parents
rOBSIDIAN3530a43f46e2: Code conventions: Run() methods are now run() in lowercase.
Branches
Unknown
Tags
Unknown