Welcome Guest, Not a member yet? Register   Sign In
Accessing a model in a much used helper
#1

Hi all,
I have this helper function which gets texts from a database to show on the website.
But I wonder if this can be optimized in terms of efficiency.
The getSiteText() function can be called many times on a single page.
Do I really need to call the TextModel every single time, or are there better ways?
PHP Code:
function getSiteText(string $textName): string
{
    $textModel = new TextModel();

    return $textModel->getText($textName);

Reply


Messages In This Thread
Accessing a model in a much used helper - by sjender - 01-19-2022, 08:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB