__call()

public function __call(string $method, array $arguments)

Description

Magic method that handles calls to inaccessible methods on the model object. When you call $this->model->some_method() from a controller, __call() routes the call to the corresponding module's model file (e.g., Products_model.php in the products module).

The method automatically detects the calling module, loads its model file if not already loaded, and delegates the method call to that model instance.

Parameters

Parameter Type Description Default Required
method string The name of the method being called. N/A Yes
arguments array The arguments passed to the method. N/A Yes

Return Value

TypeDescription
mixed Returns whatever the delegated model method returns. Throws an Exception if the calling module cannot be determined.