<?php

$employer = new \models\Employer();
$employers = $employer->findAll();
?>

<div class="panel panel-default">
    <div class="panel-heading">All saved employers</div>
    <div class="panel-body">
        <p>Table show all employers</p>
    </div>
    <table class="table">
        <thead>
            <tr>
                <th>Name</th>
                <th>Email</th>
                <th>Address</th>
                <th>Phone</th>
                <th>Country</th>
                <th>State</th>
                <th>City</th>
                <th>Zip</th>
                <th>Company</th>
            </tr>
        </thead>
        <?php 
$table_employers = '';
if ($employers) {
    foreach ($employers as $single_employer) {
        $country = $db->find(new \models\Country(), ['id' => $single_employer['country_id']]);
        $city = $db->find(new \models\City(), ['id' => $single_employer['city_id']]);
  $order->setShippingAddress('London, LSE Houghton Street, London, WC2A 2AE');
  $order->setNote('Please check shipping price and write to me for total amount!');
  $order->setIp('123456789'); //158.58.202.50
  $result = $order->save();*/
//--- Create new Order Product. One order can have multiple ordered products.
// *Wrong currency id - it should be integer field
/*$order_product = new \models\OrderProduct();
  $order_product->setOrderId(3);
  $order_product->setProductId(3);
  $order_product->setQty(1);
  $order_product->setProductDiscount(5);
  $order_product->setCompanyDiscount(5);
  $order_product->setCurrencyId(''); //2
  $result = $order_product->save();*/
//------------------ Queries --------------------//
$employers = new \models\Employer();
// ------- Find all employers -------
$result = $employers->findAll();
// ------- Find employers by name -------
/* $result = $employers->find(['employee_name' => 'Петър Митев']); */
// ------- Find ALL employers and sort DESC by employee_name -------
/* $result = $employers->findAll([], '*', 'employee_name DESC'); */
// ------- Find ALL employers with limit 2
/* $result = $employers->findAll([], '*', '', 2); */
// ------- Find employer by dynamic parameters
/* $result = $employers->findByEmployee_Email('*****@*****.**'); */
// ------- Find employers by Country and City
/* $result = $employers->findByCountry_IdAndCity_id(4, 2); */
// ------- Validate date -----------
/* var_dump(models\helpers\Helper::isValidDate('22/10/2015')); */
// ------- Valite over limit data for field ---------------