Documentation/Models

Model

Model is a component of the architectural pattern MVC
(Action-Domain-Responder for the web).

In the HLEB2 framework, the Model is represented by a template that has static access methods. The Model can provide access to a certain dataset, usually a connected DBMS (Database Management System).

The provided template can be used by the developer in their own way. It can use the built-in wrapper over PDO (class Hleb\Static\DB) or be replaced by your own template, for example, by connecting one of the existing ORM.


#Creating a Template

Apart from copying and modifying the demonstration file DefaultModel.php, there is another simple way to create the required class using a console command.

$php console --add model ExampleModel

This command will create a new template /app/Models/ExampleModel.php.
You can use another suitable name for the class.
The HLEB2 framework also allows you to create a custom template by default for this command.

Middleware Templates

Page translated: chatgpt 4-o
Back to top