<?php

class ProductsOfSuppliersMenu extends Menu
{
    public function get_vars()
    {
        $vars = parent::get_vars();
        $SQL = sqlQuery('SELECT * FROM '.getTableName('suppliers').' ORDER BY name');
        $suppliers = [];
        foreach ($SQL as $key => $row) {
            $suppliers[$key] = $row;
        }
        $SQL = sqlQuery('SELECT id, name FROM '.getTableName('producers').' ORDER BY name');
        $producer = [];
        foreach ($SQL as $key => $row) {
            $producer[$key] = $row;
        }

        return array_merge($vars, [
            'producers' => $producer,
            'suppliers' => $suppliers,
        ]
        );
    }
}
