__construct()

public function __construct(?string $module_name = null)

Description

Constructor for the Model base class. Sets the module name that this model serves, which is used for automatic loading of module‑specific model files ({Module}_model.php) and for database connection context.

Note: The framework automatically passes the module name when instantiating models via $this->model. You only need to call the constructor manually when creating Model instances programmatically.

Parameters

Parameter Type Description Default Required
module_name string|null The module name that this model belongs to. If null, derived from the calling context. null No

Return Value

Type Description
void Constructor does not return a value.

Example Usage