G
G
gachkydxvbgd2017-06-11 22:53:26
Phalcon
gachkydxvbgd, 2017-06-11 22:53:26

How to correctly implement a selection from the database?

How to correctly implement on each page of the site you need all 4 arrays from the database selection
I think when loading any page 4 requests to the database will give a load
. If cached, then how?
All data is dynamic and edited in the admin panel, you will need to update the table + cache after each editing

<?php

namespace MyApp\Controllers;

use Phalcon\Mvc\Controller;

use MyApp\Models\Pages as Pages;
use MyApp\Models\Categories as Categories;
use MyApp\Models\Items as Items;
use MyApp\Models\Settings as Settings;

class ControllerBase extends Controller
{
        $this->view->pages = Pages::find();
        $this->view->categories = Categories::find();
        $this->view->items = Items::find();
        $this->view->settings= Settings::find();
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question