<?php

class ProductsPricesMenu extends Menu
{
    public function get_vars()
    {
        $vars = parent::get_vars();

        $SQL = sqlQueryBuilder()
            ->select('*')
            ->from('suppliers')
            ->orderBy('name')
            ->execute();
        $suppliers = ['' => 'Všichni'];
        foreach ($SQL as $row) {
            $suppliers[$row['id']] = $row['name'];
        }

        $SQL = sqlQueryBuilder()
            ->select('*')
            ->from('producers')
            ->orderBy('name')
            ->execute();
        $producers = ['' => 'Všichni'];
        foreach ($SQL as $key => $row) {
            $producers[$row['id']] = $row['name'];
        }

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