Hi I have created a file Helper.php in the helper folder it contains the code:
class Helper extends Phalcon\Mvc\User\Component
{
public function GetMessage($code)
{
$message = $this->modelsManager
->createBuilder()
->columns([
'message.msg_type',
'message.msg',
])
->from(['message' => 'SystemMessage'])
->where('message.msg_code = :msg_code:',
['msg_code' => $code])
->limit(1)
->getQuery()
->getSingleResult();
return $message;
}
}
I have added to loader.php:
$config->application->helpersDir,
and to config.php:
'helpersDir' => APP_PATH . '/helpers/',
How do I actually now call the function with in a controller I have tried quite a few ways without success.
Secondly is this the best way to do this? Is there a better recommended way of setting up this global function? (in terms of best practice)
Thanks